|
| 1 | +import globals from 'globals'; |
| 2 | +import pluginJs from '@eslint/js'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import localRules from 'eslint-plugin-local-rules'; |
| 5 | +import wcPlugin from 'eslint-plugin-wc'; |
| 6 | +import litPlugin from 'eslint-plugin-lit'; |
| 7 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; |
| 8 | + |
| 9 | +import { includeIgnoreFile } from '@eslint/compat'; |
| 10 | +import path from 'node:path'; |
| 11 | +import { fileURLToPath } from 'node:url'; |
| 12 | + |
| 13 | +const __filename = fileURLToPath(import.meta.url); |
| 14 | +const __dirname = path.dirname(__filename); |
| 15 | +const gitignorePath = path.resolve(__dirname, '.gitignore'); |
| 16 | + |
| 17 | +export default [ |
| 18 | + // Recommended config applied to all files |
| 19 | + pluginJs.configs.recommended, |
| 20 | + ...tseslint.configs.recommended, |
| 21 | + wcPlugin.configs['flat/recommended'], |
| 22 | + litPlugin.configs['flat/recommended'], |
| 23 | + localRules.configs['all-warn'], |
| 24 | + eslintPluginPrettierRecommended, |
| 25 | + |
| 26 | + // Global ignores |
| 27 | + includeIgnoreFile(gitignorePath), |
| 28 | + { |
| 29 | + ignores: ['**/*.{cjs,mjs,js}', 'vite.config.ts', 'stories/'], |
| 30 | + }, |
| 31 | + |
| 32 | + // Global config |
| 33 | + { |
| 34 | + plugins: { |
| 35 | + 'local-rules': localRules, |
| 36 | + }, |
| 37 | + languageOptions: { |
| 38 | + parserOptions: { |
| 39 | + project: './tsconfig.json', |
| 40 | + tsconfigRootDir: './', |
| 41 | + }, |
| 42 | + globals: globals.browser, |
| 43 | + }, |
| 44 | + rules: { |
| 45 | + semi: ['warn', 'always'], |
| 46 | + 'no-unused-vars': 'off', //Let '@typescript-eslint/no-unused-vars' catch the errors to allow unused function parameters (ex: in interfaces) |
| 47 | + 'no-var': 'error', |
| 48 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 49 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 50 | + '@typescript-eslint/no-explicit-any': 'off', |
| 51 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 52 | + '@typescript-eslint/ban-ts-comment': 'off', //TODO: Remove (maybe) |
| 53 | + '@typescript-eslint/ban-types': 'off', //TODO: Remove (maybe) |
| 54 | + 'lit/no-useless-template-literals': 'error', |
| 55 | + 'lit/prefer-nothing': 'error', |
| 56 | + 'no-restricted-syntax': [ |
| 57 | + 'warn', |
| 58 | + { |
| 59 | + message: |
| 60 | + 'Elements should not be defined with customElement, use defineElement instead.', |
| 61 | + selector: |
| 62 | + 'ClassDeclaration > Decorator[expression.callee.name="customElement"]', |
| 63 | + }, |
| 64 | + ], |
| 65 | + }, |
| 66 | + }, |
| 67 | +]; |
0 commit comments