|
| 1 | +import { defineConfig, globalIgnores } from "eslint/config"; |
| 2 | +import jest from "eslint-plugin-jest"; |
| 3 | +import github from "eslint-plugin-github"; |
| 4 | +import prettier from "eslint-plugin-prettier"; |
| 5 | +import tseslint from "typescript-eslint"; |
| 6 | +import stylistic from '@stylistic/eslint-plugin' |
| 7 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 8 | +import globals from "globals"; |
| 9 | +import tsParser from "@typescript-eslint/parser"; |
| 10 | +import path from "node:path"; |
| 11 | +import { fileURLToPath } from "node:url"; |
| 12 | +import js from "@eslint/js"; |
| 13 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 14 | + |
| 15 | +const __filename = fileURLToPath(import.meta.url); |
| 16 | +const __dirname = path.dirname(__filename); |
| 17 | +const compat = new FlatCompat({ |
| 18 | + baseDirectory: __dirname, |
| 19 | + recommendedConfig: js.configs.recommended, |
| 20 | + allConfig: js.configs.all |
| 21 | +}); |
| 22 | + |
| 23 | +export default defineConfig([globalIgnores([ |
| 24 | + "!**/.*", |
| 25 | + "**/node_modules/", |
| 26 | + "**/dist/", |
| 27 | + "**/lib/", |
| 28 | + "**/coverage/", |
| 29 | + "**/*.json", |
| 30 | + "**/dygraph-combined.js", |
| 31 | + "**/*.mjs", |
| 32 | +]), { |
| 33 | + extends: compat.extends( |
| 34 | + "eslint:recommended", |
| 35 | + "plugin:@typescript-eslint/eslint-recommended", |
| 36 | + "plugin:@typescript-eslint/recommended", |
| 37 | + "plugin:jest/recommended", |
| 38 | + ), |
| 39 | + |
| 40 | + plugins: { |
| 41 | + "@typescript-eslint": tseslint.plugin, |
| 42 | + jest, |
| 43 | + "@typescript-eslint": typescriptEslint, |
| 44 | + "@stylistic": stylistic, |
| 45 | + github, |
| 46 | + prettier, |
| 47 | + }, |
| 48 | + |
| 49 | + ignores: [ |
| 50 | + |
| 51 | + ], |
| 52 | + |
| 53 | + files: ["**/*.ts", "**/*.tsx"], |
| 54 | + languageOptions: { |
| 55 | + globals: { |
| 56 | + ...globals.node, |
| 57 | + ...globals.jest, |
| 58 | + Atomics: "readonly", |
| 59 | + SharedArrayBuffer: "readonly", |
| 60 | + }, |
| 61 | + |
| 62 | + parser: tsParser, |
| 63 | + ecmaVersion: "latest", |
| 64 | + sourceType: "module", |
| 65 | + |
| 66 | + parserOptions: { |
| 67 | + project: ["./.github/linters/tsconfig.json", "./tsconfig.json"], |
| 68 | + }, |
| 69 | + }, |
| 70 | + |
| 71 | + rules: { |
| 72 | + camelcase: "off", |
| 73 | + "eslint-comments/no-use": "off", |
| 74 | + "eslint-comments/no-unused-disable": "off", |
| 75 | + "i18n-text/no-en": "off", |
| 76 | + "import/no-namespace": "off", |
| 77 | + "no-console": "off", |
| 78 | + "no-unused-vars": "off", |
| 79 | + "prettier/prettier": "error", |
| 80 | + |
| 81 | + "@stylistic/function-call-spacing": ["error", "never"], |
| 82 | + "@stylistic/semi": ["error", "never"], |
| 83 | + "@stylistic/type-annotation-spacing": "error", |
| 84 | + |
| 85 | + semi: "off", |
| 86 | + "@typescript-eslint/array-type": "error", |
| 87 | + "@typescript-eslint/await-thenable": "error", |
| 88 | + "@typescript-eslint/ban-ts-comment": "error", |
| 89 | + "@typescript-eslint/consistent-type-assertions": "error", |
| 90 | + |
| 91 | + "@typescript-eslint/explicit-member-accessibility": ["error", { |
| 92 | + accessibility: "no-public", |
| 93 | + }], |
| 94 | + |
| 95 | + "@typescript-eslint/explicit-function-return-type": ["error", { |
| 96 | + allowExpressions: true, |
| 97 | + }], |
| 98 | + |
| 99 | + "@typescript-eslint/no-array-constructor": "error", |
| 100 | + "@typescript-eslint/no-empty-interface": "error", |
| 101 | + "@typescript-eslint/no-explicit-any": "error", |
| 102 | + "@typescript-eslint/no-extraneous-class": "error", |
| 103 | + "@typescript-eslint/no-for-in-array": "error", |
| 104 | + "@typescript-eslint/no-inferrable-types": "error", |
| 105 | + "@typescript-eslint/no-misused-new": "error", |
| 106 | + "@typescript-eslint/no-namespace": "error", |
| 107 | + "@typescript-eslint/no-non-null-assertion": "warn", |
| 108 | + "@typescript-eslint/no-require-imports": "error", |
| 109 | + "@typescript-eslint/no-unnecessary-qualifier": "error", |
| 110 | + "@typescript-eslint/no-unnecessary-type-assertion": "error", |
| 111 | + "@typescript-eslint/no-unused-vars": "error", |
| 112 | + "@typescript-eslint/no-useless-constructor": "error", |
| 113 | + "@typescript-eslint/no-var-requires": "error", |
| 114 | + "@typescript-eslint/prefer-for-of": "warn", |
| 115 | + "@typescript-eslint/prefer-function-type": "warn", |
| 116 | + "@typescript-eslint/prefer-includes": "error", |
| 117 | + "@typescript-eslint/prefer-string-starts-ends-with": "error", |
| 118 | + "@typescript-eslint/promise-function-async": "error", |
| 119 | + "@typescript-eslint/require-array-sort-compare": "error", |
| 120 | + "@typescript-eslint/restrict-plus-operands": "error", |
| 121 | + "@typescript-eslint/space-before-function-paren": "off", |
| 122 | + "@typescript-eslint/unbound-method": "error", |
| 123 | + }, |
| 124 | +}]); |
0 commit comments