|
1 | | -import js from "@eslint/js"; |
2 | 1 | import globals from "globals"; |
| 2 | +import pluginJs from "@eslint/js"; |
3 | 3 | import tseslint from "typescript-eslint"; |
4 | | -import { defineConfig } from "eslint/config"; |
| 4 | +import unusedImports from "eslint-plugin-unused-imports"; |
5 | 5 |
|
6 | | -export default defineConfig([ |
7 | | - { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"] }, |
8 | | - { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], languageOptions: { globals: globals.browser } }, |
9 | | - tseslint.configs.recommended, |
10 | | -]); |
| 6 | +export default [ |
| 7 | + { |
| 8 | + files: ["**/*.ts", "**/*.js"], |
| 9 | + languageOptions: { |
| 10 | + globals: globals.node, |
| 11 | + }, |
| 12 | + }, |
| 13 | + pluginJs.configs.recommended, |
| 14 | + ...tseslint.configs.recommended, |
| 15 | + { |
| 16 | + plugins: { |
| 17 | + "unused-imports": unusedImports, |
| 18 | + }, |
| 19 | + rules: { |
| 20 | + // Set the rule severity to "warn" (or 1) for explicit any types |
| 21 | + "@typescript-eslint/no-explicit-any": "warn", |
| 22 | + |
| 23 | + // Disable the core ESLint and TypeScript no-unused-vars rules |
| 24 | + "no-unused-vars": "off", |
| 25 | + "@typescript-eslint/no-unused-vars": "off", |
| 26 | + |
| 27 | + // Use the correct rule names from the unused-imports plugin |
| 28 | + "unused-imports/no-unused-imports": "error", |
| 29 | + "unused-imports/no-unused-vars": [ |
| 30 | + "warn", |
| 31 | + { |
| 32 | + vars: "all", |
| 33 | + varsIgnorePattern: "^_", |
| 34 | + args: "after-used", |
| 35 | + argsIgnorePattern: "^_", |
| 36 | + }, |
| 37 | + ], |
| 38 | + // Standard ESLint rules from the built-in configs are available |
| 39 | + "no-console": "warn", |
| 40 | + "no-undef": "error", |
| 41 | + "no-unused-expressions": "error", |
| 42 | + "no-unused-labels": "error", |
| 43 | + }, |
| 44 | + }, |
| 45 | +]; |
0 commit comments