Skip to content

Commit

Permalink
[INTERNAL] Add common + specific ESLint config
Browse files Browse the repository at this point in the history
+ Update deps to newer version
  • Loading branch information
maxreichmann committed Aug 5, 2024
1 parent cc067cc commit 9fd81bc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
28 changes: 12 additions & 16 deletions eslint.config.mjs → eslint.common.config.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
import {fixupConfigRules, fixupPluginRules} from "@eslint/compat";
import jsdoc from "eslint-plugin-jsdoc";
import ava from "eslint-plugin-ava";
import globals from "globals";
import path from "node:path";
import {fileURLToPath} from "node:url";
import js from "@eslint/js";
import {FlatCompat} from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
import google from "eslint-config-google";

export default [{
ignores: [
ignores: [ // Common ignore patterns across all tooling repos
"**/coverage/",
"test/tmp/",
"test/expected/",
"test/fixtures/",
"**/docs/",
"**/jsdocs/",
],
}, ...fixupConfigRules(compat.extends("eslint:recommended", "plugin:ava/recommended", "google")), {
}, js.configs.recommended, google, ava.configs["flat/recommended"], {
name: "Common ESLint config used for all tooling repos",

plugins: {
jsdoc,
ava: fixupPluginRules(ava),
},

languageOptions: {
Expand Down Expand Up @@ -75,6 +65,11 @@ export default [{

"comma-dangle": "off",
"no-tabs": "off",
"no-console": 2, // Disallow console.log()
"no-eval": 2,
// The following rule must be disabled as of ESLint 9.
// It's removed and causes issues when present
// https://eslint.org/docs/latest/rules/valid-jsdoc
"valid-jsdoc": 0,
"jsdoc/check-examples": 0,
"jsdoc/check-param-names": 2,
Expand All @@ -100,4 +95,5 @@ export default [{
"jsdoc/valid-types": 0,
"ava/assertion-arguments": 0,
},
}];
}
];
9 changes: 9 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import eslintCommonConfig from "./eslint.common.config.js";

export default [
...eslintCommonConfig, // Load common ESLint config
{
// Add project-specific ESLint config rules here
// in order to override common config
}
];
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@
}
},
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@istanbuljs/esm-loader-hook": "^0.2.0",
"ava": "^6.1.3",
Expand All @@ -162,10 +160,11 @@
"depcheck": "^1.4.7",
"docdash": "^2.0.2",
"eslint": "^9.8.0",
"eslint-plugin-ava": "^14.0.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-ava": "^15.0.1",
"eslint-plugin-jsdoc": "^48.11.0",
"esmock": "^2.6.7",
"globals": "^15.8.0",
"globals": "^15.9.0",
"istanbul-lib-coverage": "^3.2.2",
"istanbul-lib-instrument": "^6.0.3",
"istanbul-lib-report": "^3.0.1",
Expand Down

0 comments on commit 9fd81bc

Please sign in to comment.