Skip to content

Commit c1b37e2

Browse files
authored
chore: use the flat config (#72)
1 parent dfd4a41 commit c1b37e2

File tree

8 files changed

+614
-589
lines changed

8 files changed

+614
-589
lines changed

.eslintignore

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

.eslintrc.json

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

.lintstagedrc.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const removeIgnoredFiles = async (files) => {
1111
return filteredFiles.join(" ");
1212
};
1313

14-
export default {
14+
const config = {
1515
"**/*.{ts,tsx,js,mjs,jsx}": [
1616
async (files) => {
1717
const filesToLint = await removeIgnoredFiles(files);
@@ -22,3 +22,5 @@ export default {
2222
"*.{md,html,css,scss,json,yml,yaml,md,mdx}": ["prettier -w -u"],
2323
"**/*": ["secretlint --maskSecrets"],
2424
};
25+
26+
export default config;

eslint.config.mjs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { FlatCompat } from "@eslint/eslintrc";
2+
import eslintConfigPrettier from "eslint-config-prettier";
3+
import tseslint from "typescript-eslint";
4+
5+
const compat = new FlatCompat();
6+
7+
/** @type import("eslint").Linter.Config[] */
8+
const config = tseslint.config(
9+
...compat.config({
10+
extends: ["next/core-web-vitals", "next/typescript"],
11+
}),
12+
tseslint.configs.strictTypeChecked,
13+
tseslint.configs.stylisticTypeChecked,
14+
{
15+
languageOptions: {
16+
parserOptions: {
17+
projectService: true,
18+
tsconfigRootDir: import.meta.dirname,
19+
},
20+
},
21+
},
22+
{
23+
rules: {
24+
"@typescript-eslint/consistent-type-imports": "error",
25+
"@typescript-eslint/strict-boolean-expressions": "error",
26+
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
27+
"import/order": [
28+
"error",
29+
{
30+
"newlines-between": "never",
31+
alphabetize: {
32+
order: "asc",
33+
caseInsensitive: true,
34+
},
35+
},
36+
],
37+
},
38+
},
39+
{
40+
files: ["**/*.mjs"],
41+
extends: [tseslint.configs.disableTypeChecked],
42+
},
43+
{
44+
ignores: ["**/out", "**/.next"],
45+
},
46+
eslintConfigPrettier,
47+
);
48+
49+
export default config;

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
1818
"dependencies": {
1919
"@headlessui/react": "^2.1.1",
2020
"@radix-ui/react-tooltip": "^1.1.2",
21+
"@shikijs/transformers": "^1.10.1",
22+
"@typescript-eslint/eslint-plugin": "^8.18.0",
23+
"@typescript-eslint/parser": "^8.18.0",
24+
"eslint-config-next": "^15.1.0",
25+
"eslint-config-prettier": "^9.1.0",
2126
"next": "^14.2.4",
2227
"nextra": "^3.0.0",
2328
"nextra-theme-docs": "^3.0.0",
2429
"react": "^18.3.1",
2530
"react-dom": "^18.3.1",
2631
"react-icons": "^5.2.1",
27-
"shiki": "^1.10.1",
28-
"@shikijs/transformers": "^1.10.1"
32+
"shiki": "^1.10.1"
2933
},
3034
"devDependencies": {
3135
"@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
@@ -34,22 +38,17 @@
3438
"@types/react": "^19.0.0",
3539
"@types/react-dom": "^19.0.0",
3640
"@types/react-syntax-highlighter": "^15.5.13",
37-
"@typescript-eslint/eslint-plugin": "^8.0.0",
38-
"@typescript-eslint/parser": "^8.0.0",
3941
"autoprefixer": "^10.4.19",
40-
"eslint": "8.57.1",
41-
"eslint-config-next": "15.1.0",
42-
"eslint-config-prettier": "^9.0.0",
43-
"eslint-import-resolver-typescript": "^3.6.1",
44-
"eslint-plugin-import": "^2.29.0",
42+
"eslint": "9.17.0",
4543
"husky": "^9.0.11",
4644
"lint-staged": "^15.0.0",
4745
"postcss": "^8.4.39",
4846
"prettier": "^3.2.5",
4947
"secretlint": "^9.0.0",
5048
"serve": "^14.2.3",
5149
"tailwindcss": "^3.4.4",
52-
"typescript": "^5.5.3"
50+
"typescript": "^5.5.3",
51+
"typescript-eslint": "^8.18.0"
5352
},
5453
"engines": {
5554
"node": ">=18",

0 commit comments

Comments
 (0)