Skip to content

Commit 74fcefe

Browse files
committed
Style(design-tokens): Migrate ESLint config to flat config style
1 parent 0a6e583 commit 74fcefe

File tree

5 files changed

+58
-31
lines changed

5 files changed

+58
-31
lines changed

packages/design-tokens/.eslintignore

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

packages/design-tokens/.eslintrc.cjs

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { fixupConfigRules } from '@eslint/compat';
2+
import { FlatCompat } from '@eslint/eslintrc';
3+
4+
const compat = new FlatCompat({
5+
baseDirectory: import.meta.dirname,
6+
});
7+
8+
export default [
9+
{
10+
// # .eslintignore
11+
ignores: [
12+
// # NOTE:
13+
// # The following directives are only relevant when linting the whole
14+
// # project directory, ie. running `eslint .` ⚠️
15+
// # If you compile JavaScript into some output folder, exclude it here
16+
17+
// Generated files or folders
18+
'**/node_modules/**',
19+
'**/dist/**',
20+
'**/build/**',
21+
'**/.coverage/**',
22+
'**/*.input.tsx',
23+
'**/*.output.tsx',
24+
25+
// # Highly recommended to re-include JavaScript dotfiles to lint them
26+
// # (This will cause .eslintrc.js to be linted by ESLint 🤘)
27+
'!.*.js',
28+
29+
// # Some tools use this pattern for their configuration files. Lint them!
30+
'!*.config.js',
31+
32+
// Exclude JSON files from being linted
33+
// @TODO: use `eslint-plugin-jsonc` to lint JSON files properly
34+
'**/*.json',
35+
],
36+
},
37+
...fixupConfigRules(compat.extends('eslint-config-spirit', '@lmc-eu/eslint-config-typescript')),
38+
{
39+
languageOptions: {
40+
parserOptions: {
41+
ecmaVersion: 'latest',
42+
project: './tsconfig.eslint.json',
43+
},
44+
},
45+
// @TODO: remove `files` and `plugins` when all configs are flat
46+
files: ['**/*.{js,mjs,cjs,ts,tsx,mts,cts}'],
47+
rules: {
48+
'prettier/prettier': 'off',
49+
'operator-linebreak': 'off',
50+
},
51+
},
52+
];

packages/design-tokens/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
"types": "tsc"
3838
},
3939
"devDependencies": {
40+
"@eslint/compat": "1.4.0",
41+
"@eslint/eslintrc": "3.3.1",
42+
"eslint": "8.57.1",
4043
"npm-run-all2": "6.2.6",
4144
"rimraf": "5.0.10",
4245
"shx": "0.4.0",

yarn.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4717,6 +4717,9 @@ __metadata:
47174717
version: 0.0.0-use.local
47184718
resolution: "@lmc-eu/spirit-design-tokens@workspace:packages/design-tokens"
47194719
dependencies:
4720+
"@eslint/compat": "npm:1.4.0"
4721+
"@eslint/eslintrc": "npm:3.3.1"
4722+
eslint: "npm:8.57.1"
47204723
npm-run-all2: "npm:6.2.6"
47214724
rimraf: "npm:5.0.10"
47224725
shx: "npm:0.4.0"

0 commit comments

Comments
 (0)