|
| 1 | +import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
1 | 2 | import prettier from "eslint-plugin-prettier"; |
2 | 3 | import globals from "globals"; |
3 | | -import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
4 | 4 | import tsParser from "@typescript-eslint/parser"; |
5 | | -import path from "node:path"; |
6 | | -import { fileURLToPath } from "node:url"; |
| 5 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; |
7 | 6 | import js from "@eslint/js"; |
8 | | -import { FlatCompat } from "@eslint/eslintrc"; |
9 | | - |
10 | | -const __filename = fileURLToPath(import.meta.url); |
11 | | -const __dirname = path.dirname(__filename); |
12 | | -const compat = new FlatCompat({ |
13 | | - baseDirectory: __dirname, |
14 | | - recommendedConfig: js.configs.recommended, |
15 | | - allConfig: js.configs.all |
16 | | -}); |
17 | | - |
18 | | -export default [{ |
19 | | - ignores: ["generated/", "eslint.config.mjs", "lib/", "types/", "scripts/", "benchmark/", "docs/", "electron_demo/"], |
20 | | -}, ...compat.extends("prettier"), { |
21 | | - plugins: { |
22 | | - prettier, |
23 | | - }, |
24 | 7 |
|
25 | | - languageOptions: { |
26 | | - globals: { |
27 | | - ...globals.node, |
28 | | - every: true, |
29 | | - after: true, |
30 | | - constantly: true, |
31 | | - }, |
32 | | - |
33 | | - ecmaVersion: "latest", |
34 | | - sourceType: "commonjs", |
| 8 | +export default [ |
| 9 | + { |
| 10 | + ignores: [ |
| 11 | + "eslint.config.mjs", |
| 12 | + "types/interfaces.d.ts", |
| 13 | + "test/types/index.test-d.ts", |
| 14 | + "**/generated/", |
| 15 | + "**/scripts/", |
| 16 | + "**/benchmark/", |
| 17 | + "**/docs/", |
| 18 | + "**/electron_demo/", |
| 19 | + "**/generated/", |
| 20 | + ], |
35 | 21 | }, |
36 | | - |
37 | | - rules: { |
38 | | - "prettier/prettier": "error", |
39 | | - }, |
40 | | -}, { |
41 | | - files: ["types/*.d.ts"], |
42 | | - |
43 | | - plugins: { |
44 | | - "@typescript-eslint": typescriptEslint, |
| 22 | + { |
| 23 | + ...js.configs.recommended, |
| 24 | + files: ["lib/**/*.js", "index.js"], |
45 | 25 | }, |
46 | | - |
47 | | - languageOptions: { |
48 | | - parser: tsParser, |
49 | | - sourceType: "module", |
| 26 | + { |
| 27 | + rules: { |
| 28 | + 'no-dupe-class-members': 'off', |
| 29 | + }, |
50 | 30 | }, |
51 | | - |
52 | | - rules: { |
53 | | - strict: [0, "global"], |
| 31 | + { |
| 32 | + plugins: { |
| 33 | + "@typescript-eslint": typescriptEslint, |
| 34 | + }, |
| 35 | + languageOptions: { |
| 36 | + globals: { |
| 37 | + ...globals.node, |
| 38 | + }, |
| 39 | + parser: tsParser, |
| 40 | + ecmaVersion: "latest", |
| 41 | + sourceType: "module", |
| 42 | + }, |
| 43 | + files: ['types/*.d.ts'], |
| 44 | + rules: { |
| 45 | + ...typescriptEslint.configs.recommended.rules, |
| 46 | + "@typescript-eslint/no-explicit-any": "off", |
| 47 | + }, |
54 | 48 | }, |
55 | | -}]; |
| 49 | + { |
| 50 | + plugins: { |
| 51 | + prettier, |
| 52 | + }, |
| 53 | + languageOptions: { |
| 54 | + globals: { |
| 55 | + ...globals.node, |
| 56 | + }, |
| 57 | + ecmaVersion: "latest", |
| 58 | + sourceType: "commonjs", |
| 59 | + }, |
| 60 | + files: ["lib/**/*.js", "rosidl_parser/**/*.js", "rosidl_gen/**/*.js", |
| 61 | + "rostsd_gen/**/*.js", "test/**/*.js", "example/**/*.js", "index.js"], |
| 62 | + rules: { |
| 63 | + ...eslintPluginPrettierRecommended.rules, |
| 64 | + }, |
| 65 | + } |
| 66 | +]; |
0 commit comments