diff --git a/.github/funding.yml b/.github/funding.yml deleted file mode 100644 index 5c3b91e..0000000 --- a/.github/funding.yml +++ /dev/null @@ -1,4 +0,0 @@ -github: sindresorhus -open_collective: sindresorhus -tidelift: npm/eslint-config-xo -custom: https://sindresorhus.com/donate diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b8aa86..6cb6898 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,8 +14,8 @@ jobs: - 14 - 12 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/index.js b/index.js index c1623de..f672ef3 100644 --- a/index.js +++ b/index.js @@ -40,7 +40,12 @@ module.exports = { ], 'no-empty-static-block': 'error', 'no-ex-assign': 'error', - 'no-extra-boolean-cast': 'error', + 'no-extra-boolean-cast': [ + 'error', + { + enforceForInnerExpressions: true + }, + ], // Disabled because of https://github.com/eslint/eslint/issues/6028 // 'no-extra-parens': [ // 'error', @@ -222,9 +227,18 @@ module.exports = { 'no-restricted-globals': [ 'error', 'event', + // TODO: Enable this in 2025. + // { + // name: 'Buffer', + // message: 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', + // }, + { + name: 'atob', + message: 'This API is deprecated. Use https://github.com/sindresorhus/uint8array-extras instead.', + }, { - name: 'Buffer', - message: 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', + name: 'btoa', + message: 'This API is deprecated. Use https://github.com/sindresorhus/uint8array-extras instead.', }, ], 'no-shadow-restricted-names': 'error', @@ -239,6 +253,7 @@ module.exports = { 'error', { vars: 'all', + varsIgnorePattern: /^_/.source, args: 'after-used', ignoreRestSiblings: true, argsIgnorePattern: /^_/.source, @@ -256,14 +271,15 @@ module.exports = { 'sys', 'querystring', 'colors', - { - name: 'buffer', - message: 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', - }, - { - name: 'node:buffer', - message: 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', - }, + // TODO: Enable this in 2025. + // { + // name: 'buffer', + // message: 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', + // }, + // { + // name: 'node:buffer', + // message: 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', + // }, ], 'array-bracket-newline': [ 'error', @@ -362,24 +378,34 @@ module.exports = { 'unix', ], 'lines-between-class-members': [ + 'error', + { + enforce: [ + { + blankLine: 'always', + prev: '*', + next: 'method', + }, + { + blankLine: 'always', + prev: 'method', + next: 'field', + }, + { + blankLine: 'never', + prev: 'field', + next: 'field', + }, + ], + }, + ], + 'logical-assignment-operators': [ 'error', 'always', { - // Workaround to allow class fields to not have lines between them. - // TODO: Get ESLint to add an option to ignore class fields. - exceptAfterSingleLine: true, + enforceForIfStatements: true, }, ], - - // TODO: Enable this again when targeting Node.js 16. - // 'logical-assignment-operators': [ - // 'error', - // 'always', - // { - // enforceForIfStatements: true, - // }, - // ], - 'max-depth': 'warn', 'max-len': [ 'warn', @@ -642,10 +668,7 @@ module.exports = { }, ], 'prefer-numeric-literals': 'error', - - // TODO: Enable when targeting Node.js 16. - // 'prefer-object-has-own': 'error', - + 'prefer-object-has-own': 'error', 'prefer-rest-params': 'error', 'prefer-spread': 'error', 'require-yield': 'error', diff --git a/package.json b/package.json index 9fd1ad6..17254f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-xo", - "version": "0.43.1", + "version": "0.45.0", "description": "ESLint shareable config for XO", "license": "MIT", "repository": "xojs/eslint-config-xo", @@ -10,8 +10,9 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "sideEffects": false, "engines": { - "node": ">=12" + "node": ">=18" }, "scripts": { "test": "eslint . && ava" @@ -53,10 +54,10 @@ }, "devDependencies": { "ava": "^2.4.0", - "eslint": "^8.50.0", + "eslint": "^8.56.0", "is-plain-obj": "^3.0.0" }, "peerDependencies": { - "eslint": ">=8.50.0" + "eslint": ">=8.56.0" } } diff --git a/readme.md b/readme.md index 5284bf1..8c84e8a 100644 --- a/readme.md +++ b/readme.md @@ -10,8 +10,8 @@ See [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicor ## Install -``` -$ npm install --save-dev eslint-config-xo +```sh +npm install --save-dev eslint-config-xo ``` ## Usage