Skip to content

Commit

Permalink
chore: moves eslint to flat config, migrates to eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Nov 24, 2024
1 parent aae6edd commit ef09774
Show file tree
Hide file tree
Showing 31 changed files with 859 additions and 1,207 deletions.
74 changes: 0 additions & 74 deletions .eslintrc.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion configs/.dependency-cruiser-show-metrics-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default {
theme: {
replace: false,
graph: {
splines: "ortho", // "ortho" looks nicer, but with the full graph takes long
// "ortho" looks nicer, but with the full graph takes long
splines: "ortho",
},
modules: [
{
Expand Down
107 changes: 107 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import globals from "globals";
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,
});

export default [
{
ignores: [
"**/.pnp.cjs",
"**/.yarn",
"**/node_modules",
"**/coverage",
"**/tmp",
"src/**/*.schema.mjs",
"src/report/dot-webpage/svg-in-html-snippets/script.cjs",
"test/integration/**/*",
"test/*/__fixtures__/**/*",
"test/*/*/__fixtures__/**/*",
"test/*/*/*/__fixtures__/**/*",
"test/*/__mocks__/**/*",
"test/*/*/__mocks__/**/*",
"types/**/*",
],
},
...compat.extends("moving-meadow", "plugin:@typescript-eslint/recommended"),
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2021,
sourceType: "script",
},

rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-unused-vars": "off",
"budapestian/global-constant-pattern": "off",
"security/detect-non-literal-fs-filename": "off",
"import/exports-last": "off",
"import/no-unresolved": "off",
"@typescript-eslint/no-require-imports": "off",
"no-param-reassign": "error",
"n/no-missing-import": "off",
"n/no-missing-require": "off",
"unicorn/no-empty-file": "off",
"unicorn/no-useless-fallback-in-spread": "off",
// eslint-disable-next-line no-magic-numbers
complexity: ["warn", { max: 10, variant: "classic" }],
},
},
{
files: ["**/*.d.ts"],

rules: {
"init-declarations": "off",
},
},
{
files: ["test/**/*.{js,mjs,cjs}"],

languageOptions: {
globals: {
...globals.mocha,
},
},

rules: {
complexity: "off",
"max-lines": "off",
"max-lines-per-function": "off",
"no-prototype-builtins": "off",

"mocha/valid-suite-description": [
"error",
{
pattern: "^\\[[EIU]\\]",
suiteNames: ["describe"],
message:
"start suite titles with [E], [I] or [U] to mark them as E2E, Integration or Unit test suite",
},
],
},
},
{
files: ["**/*.mjs"],

rules: {
"n/no-unsupported-features/es-syntax": "off",
},
},
];
Loading

0 comments on commit ef09774

Please sign in to comment.