Skip to content

Commit

Permalink
feat: support ESLint 8.x
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0
BREAKING CHANGE: Requires ESLint@^8.0.0
  • Loading branch information
MichaelDeBoey committed Oct 13, 2021
1 parent 70e2868 commit 8bac4e9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/validate.yml
Expand Up @@ -16,7 +16,7 @@ jobs:
if: ${{ !contains(github.head_ref, 'all-contributors') }}
strategy:
matrix:
node: [10, 12, 14, 16]
node: [12.22.0, 12, 14.17.0, 14, '16.0', 16]
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
Expand Down Expand Up @@ -50,15 +50,15 @@ jobs:
github.ref) && github.event_name == 'push' }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
uses: styfle/cancel-workflow-action@0.9.1

- name: ⬇️ Checkout repo
uses: actions/checkout@v2

- name: ⎔ Setup node
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
Expand Down
16 changes: 7 additions & 9 deletions README.md
Expand Up @@ -97,17 +97,16 @@ for it.
### Things to know

- The default config uses `@babel/eslint-parser` to support stage features that
ESLint doesn't support and it opts to use the `@babel/eslint-plugin` rules
ESLint doesn't support. It also opts to use the `@babel/eslint-plugin` rules
over the ESLint rules to support rules for these features as well.
- All plugins needed for rules used by these configs are dependencies of this
module so you don't have to install anything on your own.
- The default config actually is composed of several configurations and you can
use those individually. These are the configs it's using:
`possible-errors.js`, `best-practices.js`, `stylistic.js`, `es6/index.js`, and
`import/index.js`. You can use each of these configs yourself if you want to
leave my own personal style out of it. Also, the `es6` and `import` configs
each have a `possible-errors.js`, `best-practices.js`, and `stylistic.js`
which they are composed of as well.
- The default config actually is composed of several configurations which can be
used individually. These are the configs it's using: `possible-errors.js`,
`best-practices.js`, `stylistic.js`, `es6/index.js`, and `import/index.js`.
You can use each of these configs yourself if you want to leave my own
personal style out of it. The `import` config also has a `possible-errors.js`,
`best-practices.js`, and `stylistic.js` which it is composed of as well.

#### Example of highly customized config

Expand All @@ -116,7 +115,6 @@ module.exports = {
extends: [
'kentcdodds/possible-errors',
'kentcdodds/best-practices',
'kentcdodds/es6/possible-errors',
'kentcdodds/import',
'kentcdodds/jest',
],
Expand Down
42 changes: 18 additions & 24 deletions best-practices.js
Expand Up @@ -19,6 +19,7 @@ module.exports = {
'no-caller': 'error',
'no-case-declarations': 'error',
'no-constructor-return': 'error',
'no-delete-var': 'error',
'no-div-regex': 'error',
'no-else-return': 'off',
'no-empty-function': 'off', // we're all grown ups here...
Expand All @@ -35,6 +36,7 @@ module.exports = {
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-loop-func': 'error',
Expand All @@ -49,17 +51,32 @@ module.exports = {
'no-param-reassign': 'off',
'no-proto': 'error',
'no-redeclare': 'error',
'no-restricted-globals': ['error', 'event', 'fdescribe'],
'no-restricted-properties': 'off', // no ideas of what to disallow right now...
'no-return-assign': 'error',
'no-return-await': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'no-throw-literal': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-undefined': 'off',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'off',
'no-unused-labels': 'error',
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^ignored',
args: 'after-used',
ignoreRestSiblings: true,
},
],
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-concat': 'error',
Expand All @@ -74,30 +91,9 @@ module.exports = {
radix: 'error',
'require-await': 'off',
'require-unicode-regexp': 'off',
strict: 'error',
'vars-on-top': 'error',
yoda: 'error',

// strict
strict: 'error',

// variables
'no-delete-var': 'error',
'no-label-var': 'error',
'no-restricted-globals': ['error', 'event', 'fdescribe'],
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-undefined': 'off',
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^ignored',
args: 'after-used',
ignoreRestSiblings: true,
},
],
},
overrides: [
{
Expand Down Expand Up @@ -209,8 +205,6 @@ module.exports = {
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/unbound-method': 'error',

// variables
'@typescript-eslint/unified-signatures': 'warn',
},
},
Expand Down
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -37,10 +37,10 @@
"@babel/eslint-parser": "^7.15.4",
"@babel/eslint-plugin": "^7.14.5",
"@babel/preset-react": "^7.14.5",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"@typescript-eslint/eslint-plugin": "^5.0.0-0",
"@typescript-eslint/parser": "^5.0.0-0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-jest-dom": "^3.9.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
Expand All @@ -53,7 +53,7 @@
"devDependencies": {
"@testing-library/dom": "^7.31.2",
"@testing-library/jest-dom": "^5.14.1",
"eslint": "^7.32.0",
"eslint": "^8.0.0",
"eslint-find-rules": "^3.6.1",
"husky": "^6.0.0",
"jest": "^27.1.0",
Expand All @@ -64,7 +64,7 @@
"typescript": "^4.4.2"
},
"peerDependencies": {
"eslint": "^7.5.0",
"eslint": "^8.0.0",
"typescript": "^4.0.0"
},
"peerDependenciesMeta": {
Expand All @@ -81,7 +81,7 @@
"dist"
],
"engines": {
"node": "^10.12.0 || >=12.0.0",
"node": "^12.22.0 || ^14.17.0 || >=16.0.0",
"npm": ">=6",
"yarn": ">=1"
}
Expand Down
4 changes: 1 addition & 3 deletions possible-errors.js
Expand Up @@ -37,13 +37,11 @@ module.exports = {
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-use-before-define': ['error', 'nofunc'],
'no-useless-backreference': 'error',
'require-atomic-updates': 'off',
'use-isnan': 'error',
'valid-typeof': 'error',

// variables
'no-use-before-define': ['error', 'nofunc'],
},
overrides: [
{
Expand Down
5 changes: 1 addition & 4 deletions stylistic.js
Expand Up @@ -15,14 +15,14 @@ module.exports = {
// camelCase, PascalCase, __filename, CONST_VALUE, stream$, $el
'^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$',
],
'init-declarations': 'off',
'line-comment-position': 'off',
'lines-between-class-members': 'off',
'max-depth': ['error', 4],
'max-lines': [
'error',
{max: 2500, skipBlankLines: false, skipComments: false},
],

'max-lines-per-function': 'off', // this becomes an obvious problem when it's actually a problem...
'max-nested-callbacks': ['error', 7],
'max-params': ['error', 7],
Expand Down Expand Up @@ -52,9 +52,6 @@ module.exports = {
'sort-keys': 'off',
'sort-vars': 'off',
'spaced-comment': 'off',

// variables
'init-declarations': 'off',
},
overrides: [
{
Expand Down

0 comments on commit 8bac4e9

Please sign in to comment.