|
| 1 | +import eslint from "@eslint/js"; |
| 2 | +import eslintPluginTypeScript from "@typescript-eslint/eslint-plugin"; |
| 3 | +import tsParser from "@typescript-eslint/parser"; |
| 4 | +import eslintConfigPrettier from "eslint-config-prettier/flat"; |
| 5 | +import pluginChaiFriendly from "eslint-plugin-chai-friendly"; |
| 6 | +import mochaPlugin from "eslint-plugin-mocha"; |
| 7 | +import { globalIgnores } from "eslint/config"; |
| 8 | +import globals from "globals"; |
| 9 | +import tseslint from "typescript-eslint"; |
| 10 | + |
| 11 | +export default tseslint.config([ |
| 12 | + globalIgnores(["coverage/**", "lib/**"]), |
| 13 | + eslint.configs.recommended, |
| 14 | + tseslint.configs.recommended, |
| 15 | + tseslint.configs.strict, |
| 16 | + mochaPlugin.configs.flat.recommended, |
| 17 | + { |
| 18 | + files: ["**/*"], |
| 19 | + rules: { |
| 20 | + "linebreak-style": ["error", "unix"], |
| 21 | + }, |
| 22 | + }, |
| 23 | + { |
| 24 | + files: ["**/*.{js,ts}"], |
| 25 | + languageOptions: { |
| 26 | + parser: tsParser, |
| 27 | + parserOptions: { |
| 28 | + project: "./tsconfig.eslint.json", |
| 29 | + ecmaVersion: 2020, |
| 30 | + sourceType: "module", |
| 31 | + }, |
| 32 | + globals: { ...globals.node }, |
| 33 | + }, |
| 34 | + plugins: { |
| 35 | + "@typescript-eslint": eslintPluginTypeScript, |
| 36 | + }, |
| 37 | + rules: { |
| 38 | + "no-console": "warn", |
| 39 | + "@typescript-eslint/no-non-null-assertion": "error", |
| 40 | + "@typescript-eslint/no-unused-vars": "error", |
| 41 | + "@typescript-eslint/no-invalid-void-type": "off", |
| 42 | + "@typescript-eslint/no-dynamic-delete": "off", |
| 43 | + "@typescript-eslint/no-unused-expressions": "off", |
| 44 | + }, |
| 45 | + }, |
| 46 | + { |
| 47 | + files: ["**/*.spec.{js,ts}"], |
| 48 | + languageOptions: { |
| 49 | + globals: { ...globals.mocha }, |
| 50 | + }, |
| 51 | + plugins: { |
| 52 | + mocha: mochaPlugin, |
| 53 | + "chai-friendly": pluginChaiFriendly, |
| 54 | + }, |
| 55 | + rules: {}, |
| 56 | + }, |
| 57 | + eslintConfigPrettier, // goes last |
| 58 | +]); |
0 commit comments