|
1 | | -{ |
2 | | - "env": { |
3 | | - "browser": true, |
4 | | - "commonjs": true, |
5 | | - "es2021": true |
| 1 | +import globals from "globals"; |
| 2 | +import path from "node:path"; |
| 3 | +import { fileURLToPath } from "node:url"; |
| 4 | +import js from "@eslint/js"; |
| 5 | +import { FlatCompat } from "@eslint/eslintrc"; |
| 6 | + |
| 7 | +const __filename = fileURLToPath(import.meta.url); |
| 8 | +const __dirname = path.dirname(__filename); |
| 9 | +const compat = new FlatCompat({ |
| 10 | + baseDirectory: __dirname, |
| 11 | + recommendedConfig: js.configs.recommended, |
| 12 | + allConfig: js.configs.all |
| 13 | +}); |
| 14 | + |
| 15 | +export default [...compat.extends("google"), { |
| 16 | + languageOptions: { |
| 17 | + globals: { |
| 18 | + ...globals.browser, |
| 19 | + ...globals.commonjs, |
| 20 | + }, |
| 21 | + ecmaVersion: "latest", |
| 22 | + sourceType: "script", |
6 | 23 | }, |
7 | | - "extends": [ |
8 | | - "google" |
9 | | - ], |
10 | | - "parserOptions": { |
11 | | - "ecmaVersion": "latest" |
12 | | - }, |
13 | | - "rules": { |
| 24 | + |
| 25 | + rules: { |
14 | 26 | "array-bracket-spacing": "error", |
15 | 27 | "block-scoped-var": "error", |
16 | 28 | "block-spacing": "error", |
17 | 29 | "brace-style": "error", |
18 | | - "camelcase": "off", |
| 30 | + camelcase: "off", |
19 | 31 | "class-methods-use-this": "error", |
20 | 32 | "consistent-return": "error", |
21 | 33 | "default-case": "error", |
22 | 34 | "default-case-last": "error", |
23 | 35 | "default-param-last": "error", |
24 | 36 | "grouped-accessor-pairs": "error", |
25 | | - "indent": [ "error", 4 ], |
26 | | - "linebreak-style": [ "error", "unix" ], |
27 | | - "max-len": ["error", { "code": 120 }], |
| 37 | + indent: ["error", 4], |
| 38 | + "linebreak-style": ["error", "unix"], |
| 39 | + "max-len": ["error", { |
| 40 | + code: 120, |
| 41 | + }], |
28 | 42 | "no-caller": "error", |
29 | 43 | "no-console": "error", |
30 | 44 | "no-empty-function": "error", |
|
45 | 59 | "no-useless-backreference": "error", |
46 | 60 | "no-useless-concat": "error", |
47 | 61 | "no-var": "error", |
48 | | - "object-curly-spacing": [ |
49 | | - "error", |
50 | | - "always", |
51 | | - { |
52 | | - "arraysInObjects": true |
53 | | - } |
54 | | - ], |
| 62 | + "object-curly-spacing": ["error", "always", { |
| 63 | + arraysInObjects: true, |
| 64 | + }], |
55 | 65 | "prefer-const": "error", |
56 | 66 | "prefer-promise-reject-errors": "error", |
57 | 67 | "require-atomic-updates": "error", |
58 | 68 | "require-await": "error", |
59 | | - "require-jsdoc" : 0, |
60 | | - "semi": [ |
61 | | - "error", |
62 | | - "never" |
63 | | - ], |
64 | | - "quotes": [ |
65 | | - "error", |
66 | | - "single" |
67 | | - ], |
68 | | - "yoda": "error" |
69 | | - } |
70 | | -} |
| 69 | + "require-jsdoc": 0, |
| 70 | + semi: ["error", "never"], |
| 71 | + quotes: ["error", "single"], |
| 72 | + yoda: "error", |
| 73 | + }, |
| 74 | +}]; |
0 commit comments