|
| 1 | +import stylistic from "@stylistic/eslint-plugin"; |
| 2 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
| 3 | +import jest from "eslint-plugin-jest"; |
| 4 | +import globals from "globals"; |
| 5 | +import tsParser from "@typescript-eslint/parser"; |
| 6 | +import path from "node:path"; |
| 7 | +import { fileURLToPath } from "node:url"; |
| 8 | +import js from "@eslint/js"; |
| 9 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 10 | + |
| 11 | +const __filename = fileURLToPath(import.meta.url); |
| 12 | +const __dirname = path.dirname(__filename); |
| 13 | +const compat = new FlatCompat({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | + allConfig: js.configs.all |
| 17 | +}); |
| 18 | + |
| 19 | +export default [...compat.extends("prettier"), { |
| 20 | + files: ['**/*.cjs', '**/*.js', '**/*.ts'], |
| 21 | + ignores: [ |
| 22 | + 'bin/*', |
| 23 | + 'coverage/*', |
| 24 | + 'node_modules/*', |
| 25 | + 'obj/*', |
| 26 | + 'wwwroot/*' |
| 27 | + ], |
| 28 | + plugins: { |
| 29 | + "@stylistic": stylistic, |
| 30 | + "@typescript-eslint": typescriptEslint, |
| 31 | + jest, |
| 32 | + }, |
| 33 | + languageOptions: { |
| 34 | + globals: { |
| 35 | + ...globals.browser, |
| 36 | + ...jest.environments.globals.globals, |
| 37 | + ...globals.node, |
| 38 | + }, |
| 39 | + parser: tsParser, |
| 40 | + ecmaVersion: 5, |
| 41 | + sourceType: "module", |
| 42 | + parserOptions: { |
| 43 | + project: "./tsconfig.json", |
| 44 | + }, |
| 45 | + }, |
| 46 | + rules: { |
| 47 | + "@stylistic/indent": "error", |
| 48 | + "@stylistic/member-delimiter-style": "error", |
| 49 | + "@stylistic/quotes": ["error", "single"], |
| 50 | + "@stylistic/semi": ["error", "always"], |
| 51 | + "@stylistic/type-annotation-spacing": "error", |
| 52 | + "@typescript-eslint/naming-convention": "error", |
| 53 | + "@typescript-eslint/prefer-namespace-keyword": "error", |
| 54 | + "brace-style": ["error", "1tbs"], |
| 55 | + eqeqeq: ["error", "smart"], |
| 56 | + "id-blacklist": [ |
| 57 | + "error", |
| 58 | + "any", |
| 59 | + "Number", |
| 60 | + "number", |
| 61 | + "String", |
| 62 | + "string", |
| 63 | + "Boolean", |
| 64 | + "boolean", |
| 65 | + "Undefined", |
| 66 | + "undefined", |
| 67 | + ], |
| 68 | + "id-match": "error", |
| 69 | + "no-eval": "error", |
| 70 | + "no-redeclare": "error", |
| 71 | + "no-trailing-spaces": "error", |
| 72 | + "no-underscore-dangle": "error", |
| 73 | + "no-var": "error", |
| 74 | + "spaced-comment": ["error", "always", { |
| 75 | + markers: ["/"], |
| 76 | + }], |
| 77 | + }, |
| 78 | +}]; |
0 commit comments