Skip to content

Commit 509c0bc

Browse files
committed
chore: upgrade to eslint FlatConfig
1 parent 563621c commit 509c0bc

File tree

8 files changed

+692
-1962
lines changed

8 files changed

+692
-1962
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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

Comments
 (0)