|
1 | | -import typeScriptConfig from "@strv/eslint-config-typescript"; |
2 | | -import expoConfig from "eslint-config-expo/flat.js"; |
3 | | -import { defineConfig, globalIgnores } from "eslint/config"; |
| 1 | +import typeScriptConfig from '@strv/eslint-config-typescript' |
| 2 | +import expoConfig from 'eslint-config-expo/flat.js' |
| 3 | +import { defineConfig, globalIgnores } from 'eslint/config' |
4 | 4 |
|
5 | 5 | /** Globally ignored */ |
6 | | -const ignores = globalIgnores([".expo/", "expo-env.d.ts"]); |
| 6 | +const ignores = globalIgnores(['.expo/', 'expo-env.d.ts']) |
7 | 7 |
|
8 | 8 | /** @type {import("eslint").Linter.Config} */ |
9 | 9 | const common = { |
10 | | - name: "@strv/eslint-config-react-native", |
| 10 | + name: '@strv/eslint-config-react-native', |
11 | 11 | rules: { |
12 | 12 | // Very expensive check, see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md |
13 | | - "import/namespace": "off", |
| 13 | + 'import/namespace': 'off', |
14 | 14 | // Very expensive check, see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md |
15 | | - "import/no-duplicates": "off", |
| 15 | + 'import/no-duplicates': 'off', |
16 | 16 | // Handled by TypeScript, see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md |
17 | | - "import/no-unresolved": "off", |
| 17 | + 'import/no-unresolved': 'off', |
18 | 18 | // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default.md |
19 | | - "import/no-named-as-default": "off", |
| 19 | + 'import/no-named-as-default': 'off', |
20 | 20 | // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md |
21 | | - "import/no-named-as-default-member": "off", |
| 21 | + 'import/no-named-as-default-member': 'off', |
22 | 22 | // Handled by TypeScript. Enable noUnusedLocals in your tsconfig.json, see https://www.typescriptlang.org/tsconfig/#noUnusedLocals |
23 | 23 | // https://eslint.org/docs/latest/rules/no-unused-vars |
24 | | - "no-unused-vars": "off", |
| 24 | + 'no-unused-vars': 'off', |
25 | 25 | }, |
26 | | -}; |
| 26 | +} |
27 | 27 |
|
28 | 28 | /** @type {import("eslint").Linter.Config} */ |
29 | 29 | const react = { |
30 | | - files: ["**/*.jsx", "**/*.tsx"], |
| 30 | + files: ['**/*.jsx', '**/*.tsx'], |
31 | 31 | rules: { |
32 | 32 | // Enforce alphabetical sorting of props for better readability, see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md |
33 | | - "react/jsx-sort-props": [ |
34 | | - "error", |
| 33 | + 'react/jsx-sort-props': [ |
| 34 | + 'error', |
35 | 35 | { |
36 | | - multiline: "first", |
37 | | - reservedFirst: ["key"], |
| 36 | + multiline: 'first', |
| 37 | + reservedFirst: ['key'], |
38 | 38 | callbacksLast: true, |
39 | 39 | shorthandLast: true, |
40 | 40 | }, |
41 | 41 | ], |
42 | 42 | // DisplayName is not required for React Native components, see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md |
43 | | - "react/display-name": "off", |
| 43 | + 'react/display-name': 'off', |
44 | 44 | }, |
45 | | -}; |
| 45 | +} |
46 | 46 |
|
47 | 47 | /** @type {import("eslint").Linter.Config} */ |
48 | 48 | const typescript = defineConfig([ |
49 | 49 | typeScriptConfig, |
50 | 50 | { |
51 | | - files: ["**/*.ts", "**/*.tsx"], |
| 51 | + files: ['**/*.ts', '**/*.tsx'], |
52 | 52 | rules: { |
53 | 53 | // Handled by TypeScript. Enable noUnusedLocals in your tsconfig.json, see https://www.typescriptlang.org/tsconfig/#noUnusedLocals |
54 | 54 | // https://typescript-eslint.io/rules/no-unused-vars/ |
55 | | - "@typescript-eslint/no-unused-vars": "off", |
| 55 | + '@typescript-eslint/no-unused-vars': 'off', |
56 | 56 | // Its common in React Native to import types using require syntax, see https://reactnative.dev/docs/images#static-image-resources |
57 | 57 | // https://typescript-eslint.io/rules/no-require-imports/ |
58 | | - "@typescript-eslint/no-require-imports": "off", |
| 58 | + '@typescript-eslint/no-require-imports': 'off', |
59 | 59 | // Very expensive check, see https://typescript-eslint.io/rules/promise-function-async/ |
60 | | - "@typescript-eslint/promise-function-async": "off", |
| 60 | + '@typescript-eslint/promise-function-async': 'off', |
61 | 61 |
|
62 | 62 | // Allows variable shadowing in TypeScript contexts, see https://typescript-eslint.io/rules/no-shadow/ |
63 | | - "@typescript-eslint/no-shadow": "off", |
| 63 | + '@typescript-eslint/no-shadow': 'off', |
64 | 64 | // Allows both interface and type definitions, see https://typescript-eslint.io/rules/consistent-type-definitions/ |
65 | | - "@typescript-eslint/consistent-type-definitions": "off", |
| 65 | + '@typescript-eslint/consistent-type-definitions': 'off', |
66 | 66 | // Allows Promises in places where they might not be handled properly, see https://typescript-eslint.io/rules/no-misused-promises/ |
67 | | - "@typescript-eslint/no-misused-promises": "off", |
| 67 | + '@typescript-eslint/no-misused-promises': 'off', |
68 | 68 | // Allows assignments of any typed values, see https://typescript-eslint.io/rules/no-unsafe-assignment/ |
69 | | - "@typescript-eslint/no-unsafe-assignment": "off", |
| 69 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
70 | 70 | // Allows returning any typed values from functions, see https://typescript-eslint.io/rules/no-unsafe-return/ |
71 | | - "@typescript-eslint/no-unsafe-return": "off", |
| 71 | + '@typescript-eslint/no-unsafe-return': 'off', |
72 | 72 | // Allows unbound method references that may lose 'this' context, see https://typescript-eslint.io/rules/unbound-method/ |
73 | | - "@typescript-eslint/unbound-method": "off", |
| 73 | + '@typescript-eslint/unbound-method': 'off', |
74 | 74 | // Allows member access on any typed values, see https://typescript-eslint.io/rules/no-unsafe-member-access/ |
75 | | - "@typescript-eslint/no-unsafe-member-access": "off", |
| 75 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
76 | 76 |
|
77 | 77 | // Enforce consistent type imports with inline style, see https://typescript-eslint.io/rules/consistent-type-imports/ |
78 | | - "@typescript-eslint/consistent-type-imports": [ |
79 | | - "error", |
80 | | - { prefer: "type-imports", fixStyle: "inline-type-imports" }, |
| 78 | + '@typescript-eslint/consistent-type-imports': [ |
| 79 | + 'error', |
| 80 | + { prefer: 'type-imports', fixStyle: 'inline-type-imports' }, |
81 | 81 | ], |
82 | 82 | // Allow throwing non-Error objects, but only Promises are allowed in React codebases, see https://typescript-eslint.io/rules/only-throw-error/ |
83 | | - "@typescript-eslint/only-throw-error": ["error", { allow: ["Promise"] }], |
| 83 | + '@typescript-eslint/only-throw-error': ['error', { allow: ['Promise'] }], |
84 | 84 | }, |
85 | 85 | }, |
86 | | -]); |
| 86 | +]) |
87 | 87 |
|
88 | | -export default defineConfig([expoConfig, ignores, common, typescript, react]); |
| 88 | +export default defineConfig([expoConfig, ignores, common, typescript, react]) |
0 commit comments