|
1 | | -import eslintPluginJs from "@eslint/js"; |
2 | | -import eslintPluginJsonc from "eslint-plugin-jsonc"; |
3 | | -import eslintPluginStylistic from "@stylistic/eslint-plugin"; |
| 1 | +import {defineConfig} from "eslint/config"; |
4 | 2 | import globals from "globals"; |
5 | | -import {flatConfigs as importConfigs} from "eslint-plugin-import-x"; |
| 3 | +import {flatConfigs as importX} from "eslint-plugin-import-x"; |
| 4 | +import js from "@eslint/js"; |
| 5 | +import json from "@eslint/json"; |
| 6 | +import stylistic from "@stylistic/eslint-plugin"; |
6 | 7 |
|
7 | | -const config = [ |
8 | | - eslintPluginJs.configs.all, |
9 | | - eslintPluginStylistic.configs.all, |
10 | | - importConfigs.recommended, |
11 | | - ...eslintPluginJsonc.configs["flat/recommended-with-jsonc"], |
12 | | - { |
13 | | - "ignores": ["package-lock.json"] |
14 | | - }, |
| 8 | +export default defineConfig([ |
15 | 9 | { |
16 | 10 | "files": ["**/*.js"], |
17 | 11 | "languageOptions": { |
| 12 | + "ecmaVersion": "latest", |
18 | 13 | "globals": { |
19 | 14 | ...globals.browser, |
20 | 15 | ...globals.node, |
21 | 16 | "moment": "readonly" |
22 | | - }, |
23 | | - "sourceType": "commonjs" |
| 17 | + } |
24 | 18 | }, |
| 19 | + "plugins": {js, stylistic}, |
| 20 | + "extends": [importX.recommended, "js/all", "stylistic/all"], |
25 | 21 | "rules": { |
26 | 22 | "@stylistic/dot-location": ["error", "property"], |
27 | 23 | "@stylistic/function-call-argument-newline": ["error", "consistent"], |
@@ -79,13 +75,17 @@ const config = [ |
79 | 75 | }, |
80 | 76 | "sourceType": "module" |
81 | 77 | }, |
| 78 | + "plugins": {js, stylistic}, |
| 79 | + "extends": [importX.recommended, "js/all", "stylistic/all"], |
82 | 80 | "rules": { |
83 | 81 | "@stylistic/array-element-newline": ["error", "consistent"], |
84 | 82 | "@stylistic/indent": ["error", 2], |
| 83 | + "@stylistic/object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}], |
| 84 | + "import-x/no-unresolved": ["error", {"ignore": ["eslint/config"]}], |
85 | 85 | "no-magic-numbers": "off", |
86 | | - "one-var": "off" |
| 86 | + "one-var": "off", |
| 87 | + "sort-keys": "off" |
87 | 88 | } |
88 | | - } |
89 | | -]; |
90 | | - |
91 | | -export default config; |
| 89 | + }, |
| 90 | + {"files": ["**/*.json"], "ignores": ["package-lock.json"], "plugins": {json}, "extends": ["json/recommended"], "language": "json/json"} |
| 91 | +]); |
0 commit comments