|
| 1 | +import js from "@eslint/js"; |
| 2 | +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; |
| 3 | +import neostandard from "neostandard"; |
| 4 | +import tsEslint from "typescript-eslint"; |
| 5 | +import tsEslintParser from "@typescript-eslint/parser"; |
| 6 | +import globals from "globals"; |
| 7 | +import agamaI18nEslintPlugin from "eslint-plugin-agama-i18n"; |
| 8 | +import i18nextEslintPlugin from "eslint-plugin-i18next"; |
| 9 | +import tsEslintPlugin from "@typescript-eslint/eslint-plugin"; |
| 10 | +import reactHooksPlugin from "eslint-plugin-react-hooks"; |
| 11 | + |
| 12 | +const neostandardConfig = neostandard({ semi: true, noStyle: true }); |
| 13 | + |
| 14 | +export default [ |
| 15 | + ...neostandardConfig, |
| 16 | + js.configs.recommended, |
| 17 | + ...tsEslint.configs.recommended, |
| 18 | + eslintPluginPrettierRecommended, |
| 19 | + { |
| 20 | + languageOptions: { |
| 21 | + ecmaVersion: 7, |
| 22 | + sourceType: "module", |
| 23 | + globals: { |
| 24 | + ...globals.browser, |
| 25 | + ...globals.commonjs, |
| 26 | + ...globals.jest, |
| 27 | + ...globals.node, |
| 28 | + msCrypto: true, |
| 29 | + }, |
| 30 | + parser: tsEslintParser, |
| 31 | + }, |
| 32 | + }, |
| 33 | + { |
| 34 | + plugins: { |
| 35 | + "agama-i18n": agamaI18nEslintPlugin, |
| 36 | + i18next: i18nextEslintPlugin, |
| 37 | + "typescript-eslint": tsEslintPlugin, |
| 38 | + "react-hooks": reactHooksPlugin, |
| 39 | + }, |
| 40 | + }, |
| 41 | + { |
| 42 | + rules: { |
| 43 | + "agama-i18n/string-literals": "error", |
| 44 | + "i18next/no-literal-string": "error", |
| 45 | + "no-var": "error", |
| 46 | + "no-multi-str": "off", |
| 47 | + "no-use-before-define": "off", |
| 48 | + "@typescript-eslint/no-unused-vars": [ |
| 49 | + "error", |
| 50 | + { |
| 51 | + ignoreRestSiblings: true, |
| 52 | + }, |
| 53 | + ], |
| 54 | + "@typescript-eslint/no-unsafe-function-type": "off", |
| 55 | + "@typescript-eslint/no-unused-expressions": "off", |
| 56 | + "@typescript-eslint/no-use-before-define": "warn", |
| 57 | + "@typescript-eslint/ban-ts-comment": "off", |
| 58 | + "lines-between-class-members": [ |
| 59 | + "error", |
| 60 | + "always", |
| 61 | + { |
| 62 | + exceptAfterSingleLine: true, |
| 63 | + }, |
| 64 | + ], |
| 65 | + "prefer-promise-reject-errors": [ |
| 66 | + "error", |
| 67 | + { |
| 68 | + allowEmptyReject: true, |
| 69 | + }, |
| 70 | + ], |
| 71 | + "react-hooks/rules-of-hooks": "error", |
| 72 | + "react-hooks/exhaustive-deps": "error", |
| 73 | + camelcase: "off", |
| 74 | + "comma-dangle": "off", |
| 75 | + curly: "off", |
| 76 | + "jsx-quotes": "off", |
| 77 | + "key-spacing": "off", |
| 78 | + "no-console": "off", |
| 79 | + quotes: "off", |
| 80 | + "react/jsx-curly-spacing": "off", |
| 81 | + "react/jsx-indent-props": "off", |
| 82 | + "react/prop-types": "off", |
| 83 | + "space-before-function-paren": "off", |
| 84 | + "n/no-callback-literal": "off", |
| 85 | + }, |
| 86 | + }, |
| 87 | + { |
| 88 | + files: ["**/*.test.*", "src/test-utils.js"], |
| 89 | + rules: { "i18next/no-literal-string": "off" }, |
| 90 | + }, |
| 91 | + { |
| 92 | + files: ["src/i18n.test.js"], |
| 93 | + rules: { "agama-i18n/string-literals": "off" }, |
| 94 | + }, |
| 95 | + { |
| 96 | + ignores: ["node_modules/*", "src/lib/*", "src/**/test-data/*"], |
| 97 | + }, |
| 98 | +]; |
0 commit comments