diff --git a/base.js b/base.js index 3fe44dc..92d9a81 100644 --- a/base.js +++ b/base.js @@ -5,11 +5,12 @@ module.exports = { // @TODO: Consider configuring https://www.npmjs.com/package/eslint-plugin-jsdoc // @TODO: Consider configuring https://www.npmjs.com/package/eslint-plugin-eslint-comments extends: [ - './rules/prettier', './rules/base', './rules/babel', './rules/import', './rules/import-sort', + // @NOTE: Always extend the Prettier rules last. + './rules/prettier', ], // @NOTE: Consider switching back to ESLint's default parser (Espree) once // it supports class fields. diff --git a/node.js b/node.js index 50f4627..85df904 100644 --- a/node.js +++ b/node.js @@ -3,5 +3,8 @@ module.exports = { node: true, }, // @TODO: Consider configuring https://www.npmjs.com/package/eslint-plugin-node - extends: [], + extends: [ + // @NOTE: Always extend the Prettier rules last. + './rules/prettier', + ], }; diff --git a/react.js b/react.js index 3e237b1..73ffd04 100644 --- a/react.js +++ b/react.js @@ -1,7 +1,12 @@ module.exports = { overrides: [ { - extends: ['./rules/react', './rules/react-hooks'], + extends: [ + './rules/react', + './rules/react-hooks', + // @NOTE: Always extend the Prettier rules last. + './rules/prettier', + ], files: ['*.jsx', '*.tsx'], parserOptions: { babelOptions: { diff --git a/rules/base.js b/rules/base.js index a71ca91..bacb4ab 100644 --- a/rules/base.js +++ b/rules/base.js @@ -18,7 +18,6 @@ module.exports = { complexity: ['warn', 20], 'consistent-return': 'error', 'consistent-this': 'off', // @TODO - curly: ['warn', 'all'], // @PRETTIER @AUTOFIX 'default-case-last': 'off', // @TODO 'default-case': 'off', 'default-param-last': 'off', // @TODO diff --git a/rules/prettier.js b/rules/prettier.js index 0d1bb72..f2ee811 100644 --- a/rules/prettier.js +++ b/rules/prettier.js @@ -1,5 +1,6 @@ -// Rules regarding eslint-plugin-prettier. +// Rules regarding eslint-plugin-prettier and eslint-config-prettier. // See: https://www.npmjs.com/package/eslint-plugin-prettier +// See: https://www.npmjs.com/package/eslint-config-prettier module.exports = { extends: [ // @TODO: See if we can move away from running Prettier through ESLint. @@ -9,7 +10,10 @@ module.exports = { // See: https://github.com/prettier/eslint-plugin-prettier#recommended-configuration 'plugin:prettier/recommended', ], + // @NOTE: Please take extra caution when turning rules back on here as these + // get the final say. Plugins might require them to be turned off. rules: { + curly: ['warn', 'all'], // @PRETTIER @AUTOFIX // Override: Warn instead of error on code formatting issues. 'prettier/prettier': 'warn', }, diff --git a/typeinfo.js b/typeinfo.js index 1c1fc04..b1f4507 100644 --- a/typeinfo.js +++ b/typeinfo.js @@ -3,7 +3,11 @@ module.exports = { { // @NOTE: These rules are not included in the default configuration // because they require project-specific (TypeScript) configuration. - extends: ['./rules/typeinfo'], + extends: [ + './rules/typeinfo', + // @NOTE: Always extend the Prettier rules last. + './rules/prettier', + ], files: ['*.ts', '*.tsx'], }, ], diff --git a/typescript.js b/typescript.js index 7257d03..1ae4839 100644 --- a/typescript.js +++ b/typescript.js @@ -2,7 +2,11 @@ module.exports = { overrides: [ { // @TODO: Consider configuring https://www.npmjs.com/package/eslint-plugin-tsdoc - extends: ['./rules/typescript'], + extends: [ + './rules/typescript', + // @NOTE: Always extend the Prettier rules last. + './rules/prettier', + ], files: ['*.ts', '*.tsx'], // Reconfigure the parser for .ts/.tsx files to support TypeScript. // Babel's ESLint parser is not used here because it cannot provide