Skip to content

Commit

Permalink
refactor: remove deprecated rules
Browse files Browse the repository at this point in the history
BREAKING CHANGE: introduce eslint-plugin-n
  • Loading branch information
pboeder committed Mar 29, 2023
1 parent d294922 commit ae41381
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ fileignoreconfig:
- filename: CHANGELOG.md
checksum: b31d3cb19e6bbbc478906362fdd184439e6abe230bd2a431b205d64d309c412f
- filename: yarn.lock
checksum: 9991cb734160bd045fa201918eadd23612cf4de24fdb30f306ac4dcc2388e696
checksum: 8ce23df7f32cde86f8dc824fcefd30c833dec34a0865c73bac65fa43565005f3
version: "1.0"
3 changes: 2 additions & 1 deletion packages/eslint-config-porschedigital-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"confusing-browser-globals": "1.0.11",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jest": "27.2.1"
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-n": "15.7.0"
}
}
4 changes: 0 additions & 4 deletions packages/eslint-config-porschedigital-base/rules/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ module.exports = {
// disallow comparisons with the value NaN
"use-isnan": "error",

// ensure JSDoc comments are valid
// https://eslint.org/docs/rules/valid-jsdoc
"valid-jsdoc": "off",

// ensure that the results of typeof are compared against a valid string
// https://eslint.org/docs/rules/valid-typeof
"valid-typeof": ["error", { requireStringLiterals: true }],
Expand Down
37 changes: 11 additions & 26 deletions packages/eslint-config-porschedigital-base/rules/node.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
module.exports = {
extends: ["plugin:n/recommended"],
env: {
node: true,
},
rules: {
// enforce return after a callback
"callback-return": "off",

// require all requires be top-level
// https://eslint.org/docs/rules/global-require
"global-require": "error",

// enforces error handling in callbacks (node environment)
"handle-callback-err": "off",

// disallow use of the Buffer() constructor
// https://eslint.org/docs/rules/no-buffer-constructor
"no-buffer-constructor": "error",
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
"n/global-require": "error",

// disallow mixing regular variable and require declarations
"no-mixed-requires": ["off", false],
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md
"n/no-mixed-requires": ["off", false],

// disallow use of new operator with the require function
"no-new-require": "error",
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
"n/no-new-require": "error",

// disallow string concatenation with __dirname and __filename
// https://eslint.org/docs/rules/no-path-concat
"no-path-concat": "error",
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
"n/no-path-concat": "error",

// disallow use of process.env
"no-process-env": "off",

// disallow process.exit()
"no-process-exit": "off",

// restrict usage of specified node modules
"no-restricted-modules": "off",

// disallow use of synchronous methods (off by default)
"no-sync": "off",
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md
"n/no-process-env": "error",
},
};
10 changes: 0 additions & 10 deletions packages/eslint-config-porschedigital-base/rules/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,6 @@ module.exports = {
// https://eslint.org/docs/rules/new-parens
// "new-parens": "error",

// allow/disallow an empty newline after var statement
"newline-after-var": "off",

// https://eslint.org/docs/rules/newline-before-return
"newline-before-return": "off",

// enforces new line after each method call in the chain to make it
// more readable and easy to maintain
// https://eslint.org/docs/rules/newline-per-chained-call
Expand Down Expand Up @@ -553,10 +547,6 @@ module.exports = {
// TS: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
quotes: ["error", "double", { avoidEscape: true }],

// do not require jsdoc
// https://eslint.org/docs/rules/require-jsdoc
"require-jsdoc": "off",

// require or disallow use of semicolons instead of ASI
semi: ["error", "always"],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,6 @@ module.exports = {
},
],

// require onBlur instead of onChange
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md
"jsx-a11y/no-onchange": "off",

// ensure HTML elements do not specify redundant ARIA roles
// https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
"jsx-a11y/no-redundant-roles": "error",
Expand Down
9 changes: 0 additions & 9 deletions packages/eslint-config-porschedigital-react/rules/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ module.exports = {
},
],

// Enforce defaultProps declarations alphabetical sorting
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
"react/jsx-sort-default-props": [
"off",
{
ignoreCase: true,
},
],

// Prevent React to be incorrectly marked as unused
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
"react/jsx-uses-react": ["error"],
Expand Down
85 changes: 83 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ __metadata:
eslint-find-rules: 4.1.0
eslint-plugin-import: 2.27.5
eslint-plugin-jest: 27.2.1
eslint-plugin-n: 15.7.0
prettier: 2.8.7
typescript: 5.0.2
peerDependencies:
Expand Down Expand Up @@ -875,6 +876,15 @@ __metadata:
languageName: node
linkType: hard

"builtins@npm:^5.0.1":
version: 5.0.1
resolution: "builtins@npm:5.0.1"
dependencies:
semver: ^7.0.0
checksum: 66d204657fe36522822a95b288943ad11b58f5eaede235b11d8c4edaa28ce4800087d44a2681524c340494aadb120a0068011acabe99d30e8f11a7d826d83515
languageName: node
linkType: hard

"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2":
version: 1.0.2
resolution: "call-bind@npm:1.0.2"
Expand Down Expand Up @@ -1430,6 +1440,18 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-es@npm:^4.1.0":
version: 4.1.0
resolution: "eslint-plugin-es@npm:4.1.0"
dependencies:
eslint-utils: ^2.0.0
regexpp: ^3.0.0
peerDependencies:
eslint: ">=4.19.1"
checksum: 26b87a216d3625612b1d3ca8653ac8a1d261046d2a973bb0eb2759070267d2bfb0509051facdeb5ae03dc8dfb51a434be23aff7309a752ca901d637da535677f
languageName: node
linkType: hard

"eslint-plugin-import@npm:2.27.5":
version: 2.27.5
resolution: "eslint-plugin-import@npm:2.27.5"
Expand Down Expand Up @@ -1498,6 +1520,24 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-n@npm:15.7.0":
version: 15.7.0
resolution: "eslint-plugin-n@npm:15.7.0"
dependencies:
builtins: ^5.0.1
eslint-plugin-es: ^4.1.0
eslint-utils: ^3.0.0
ignore: ^5.1.1
is-core-module: ^2.11.0
minimatch: ^3.1.2
resolve: ^1.22.1
semver: ^7.3.8
peerDependencies:
eslint: ">=7.0.0"
checksum: cfbcc67e62adf27712afdeadf13223cb9717f95d4af8442056d9d4c97a8b88af76b7969f75deaac26fa98481023d6b7c9e43a28909e7f0468f40b3024b7bcfae
languageName: node
linkType: hard

"eslint-plugin-react-hooks@npm:4.6.0":
version: 4.6.0
resolution: "eslint-plugin-react-hooks@npm:4.6.0"
Expand Down Expand Up @@ -1559,6 +1599,40 @@ __metadata:
languageName: node
linkType: hard

"eslint-utils@npm:^2.0.0":
version: 2.1.0
resolution: "eslint-utils@npm:2.1.0"
dependencies:
eslint-visitor-keys: ^1.1.0
checksum: 27500938f348da42100d9e6ad03ae29b3de19ba757ae1a7f4a087bdcf83ac60949bbb54286492ca61fac1f5f3ac8692dd21537ce6214240bf95ad0122f24d71d
languageName: node
linkType: hard

"eslint-utils@npm:^3.0.0":
version: 3.0.0
resolution: "eslint-utils@npm:3.0.0"
dependencies:
eslint-visitor-keys: ^2.0.0
peerDependencies:
eslint: ">=5"
checksum: 0668fe02f5adab2e5a367eee5089f4c39033af20499df88fe4e6aba2015c20720404d8c3d6349b6f716b08fdf91b9da4e5d5481f265049278099c4c836ccb619
languageName: node
linkType: hard

"eslint-visitor-keys@npm:^1.1.0":
version: 1.3.0
resolution: "eslint-visitor-keys@npm:1.3.0"
checksum: 37a19b712f42f4c9027e8ba98c2b06031c17e0c0a4c696cd429bd9ee04eb43889c446f2cd545e1ff51bef9593fcec94ecd2c2ef89129fcbbf3adadbef520376a
languageName: node
linkType: hard

"eslint-visitor-keys@npm:^2.0.0":
version: 2.1.0
resolution: "eslint-visitor-keys@npm:2.1.0"
checksum: e3081d7dd2611a35f0388bbdc2f5da60b3a3c5b8b6e928daffff7391146b434d691577aa95064c8b7faad0b8a680266bcda0a42439c18c717b80e6718d7e267d
languageName: node
linkType: hard

"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.0":
version: 3.4.0
resolution: "eslint-visitor-keys@npm:3.4.0"
Expand Down Expand Up @@ -2072,7 +2146,7 @@ __metadata:
languageName: node
linkType: hard

"ignore@npm:^5.2.0":
"ignore@npm:^5.1.1, ignore@npm:^5.2.0":
version: 5.2.4
resolution: "ignore@npm:5.2.4"
checksum: 3d4c309c6006e2621659311783eaea7ebcd41fe4ca1d78c91c473157ad6666a57a2df790fe0d07a12300d9aac2888204d7be8d59f9aaf665b1c7fcdb432517ef
Expand Down Expand Up @@ -3176,6 +3250,13 @@ __metadata:
languageName: node
linkType: hard

"regexpp@npm:^3.0.0":
version: 3.2.0
resolution: "regexpp@npm:3.2.0"
checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8
languageName: node
linkType: hard

"require-directory@npm:^2.1.1":
version: 2.1.1
resolution: "require-directory@npm:2.1.1"
Expand Down Expand Up @@ -3325,7 +3406,7 @@ __metadata:
languageName: node
linkType: hard

"semver@npm:7.3.8, semver@npm:^7.3.4, semver@npm:^7.3.7":
"semver@npm:7.3.8, semver@npm:^7.0.0, semver@npm:^7.3.4, semver@npm:^7.3.7, semver@npm:^7.3.8":
version: 7.3.8
resolution: "semver@npm:7.3.8"
dependencies:
Expand Down

0 comments on commit ae41381

Please sign in to comment.