Skip to content

Commit

Permalink
chore: cleanup eslint (#5016)
Browse files Browse the repository at this point in the history
* chore: remove custom eslint rule in favor of using built-in rule

* chore: fix parsing errors from eslint/babel in node_modules

Co-authored-by: Lukas Holzer <lukas.holzer@netlify.com>
  • Loading branch information
danez and lukasholzer authored Sep 27, 2022
1 parent 6cd52d1 commit 138681d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 99 deletions.
29 changes: 23 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ const { overrides } = require('@netlify/eslint-config-node')
module.exports = {
extends: '@netlify/eslint-config-node',
plugins: ['sort-destructure-keys'],
parserOptions: {
babelOptions: {
parserOpts: {
sourceType: 'unambiguous',
},
},
},
rules: {
// Those rules from @netlify/eslint-config-node are currently disabled
// TODO: remove, so those rules are enabled
Expand Down Expand Up @@ -32,6 +39,9 @@ module.exports = {
sourceType: 'module',
babelOptions: {
presets: ['@babel/preset-react'],
parserOpts: {
sourceType: 'module',
},
},
},
rules: {
Expand All @@ -57,6 +67,11 @@ module.exports = {
},
parserOptions: {
sourceType: 'module',
babelOptions: {
parserOpts: {
sourceType: 'module',
},
},
},
},
{
Expand All @@ -69,12 +84,14 @@ module.exports = {
{
files: ['src/**/*.js'],
rules: {
// once a solution for npm 6 is found add this to package.json
// "eslint-plugin-local-rules": "file:tools/eslint-rules",
// add it to the plugins on top: `plugins: ['sort-destructure-keys', 'local-rules'],`
//
// after that uncomment the next line
// 'local-rules/no-direct-chalk-import': 2,
'no-restricted-modules': [
'error',
{
name: 'chalk',
message:
'Please use the safe chalk import that handles colors for json output. `const { chalk } = require("src/utils")`',
},
],
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/utils/command-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const os = require('os')
const process = require('process')
const { format, inspect } = require('util')

// eslint-disable-next-line no-restricted-modules
const { Instance: ChalkInstance } = require('chalk')
const chokidar = require('chokidar')
const decache = require('decache')
Expand Down
5 changes: 0 additions & 5 deletions tools/eslint-rules/index.js

This file was deleted.

42 changes: 0 additions & 42 deletions tools/eslint-rules/no-direct-chalk-import/index.js

This file was deleted.

33 changes: 0 additions & 33 deletions tools/eslint-rules/no-direct-chalk-import/rule.test.js

This file was deleted.

13 changes: 0 additions & 13 deletions tools/eslint-rules/package.json

This file was deleted.

1 comment on commit 138681d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 223 MB

Please sign in to comment.