Skip to content

Commit 11277de

Browse files
43081jAmirSa12
andauthored
chore: upgrade eslint config to flat config (#14)
* chore: upgrade eslint config to flat config Migrates the config to be a flat config file (`eslint.config.js`). To facilitate this, also updates a couple of packages: - `typescript-eslint` (and drops the `@typescript-eslint/*` packages) - prettier - prettier ESLint config We also removed `eslint-plugin-prettier` since the `format:check` script achieves the same, and the ESLint config disables all stylistic rules. * pnpm install * demo.citty * using void operator --------- Co-authored-by: AmirSa12 <[email protected]>
1 parent fa066b9 commit 11277de

File tree

9 files changed

+214
-226
lines changed

9 files changed

+214
-226
lines changed

.eslintrc.json

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

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: pnpm test
3838

3939
typecheck:
40-
name: Type Check
40+
name: Lint and Type Check
4141
runs-on: ubuntu-latest
4242

4343
steps:
@@ -57,5 +57,8 @@ jobs:
5757
- name: Install deps
5858
run: pnpm install
5959

60+
- name: Lint
61+
run: pnpm lint
62+
6063
- name: Type-check
6164
run: pnpm type-check

demo.citty.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineCommand, createMain, CommandDef } from 'citty';
1+
import { defineCommand, createMain, CommandDef, ArgsDef } from 'citty';
22
import tab from './src/citty';
33

44
const main = defineCommand({
@@ -58,7 +58,7 @@ const lintCommand = defineCommand({
5858
main.subCommands = {
5959
dev: devCommand,
6060
lint: lintCommand,
61-
} as Record<string, CommandDef<any>>;
61+
} as Record<string, CommandDef<ArgsDef>>;
6262

6363
const completion = await tab(main, {
6464
subCommands: {
@@ -121,7 +121,7 @@ const completion = await tab(main, {
121121
},
122122
});
123123

124-
completion;
124+
void completion;
125125

126126
const cli = createMain(main);
127127

eslint.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import eslintjs from '@eslint/js';
2+
import { configs as tseslintConfigs } from 'typescript-eslint';
3+
import prettierConfig from 'eslint-config-prettier';
4+
5+
const { configs: eslintConfigs } = eslintjs;
6+
7+
export default [
8+
{
9+
...eslintConfigs.recommended,
10+
files: ['src/**/*.ts'],
11+
},
12+
...tseslintConfigs.strict,
13+
{
14+
rules: {
15+
'@typescript-eslint/no-unused-vars': 'off',
16+
},
17+
},
18+
prettierConfig,
19+
];

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"format": "prettier --write .",
1212
"format:check": "prettier --check .",
1313
"build": "tsup",
14-
"prepare": "pnpm build"
14+
"prepare": "pnpm build",
15+
"lint": "eslint src \"./*.ts\""
1516
},
1617
"files": [
1718
"dist"
@@ -21,15 +22,13 @@
2122
"license": "ISC",
2223
"devDependencies": {
2324
"@types/node": "^22.7.4",
24-
"@typescript-eslint/eslint-plugin": "^8.20.0",
25-
"@typescript-eslint/parser": "^8.20.0",
2625
"cac": "^6.7.14",
2726
"citty": "^0.1.6",
2827
"eslint-config-prettier": "^10.0.1",
29-
"eslint-plugin-prettier": "^5.2.2",
30-
"prettier": "^3.4.2",
28+
"prettier": "^3.5.2",
3129
"tsup": "^8.3.6",
3230
"tsx": "^4.19.1",
31+
"typescript-eslint": "^8.25.0",
3332
"typescript": "^5.7.3",
3433
"vitest": "^2.1.3"
3534
},

0 commit comments

Comments
 (0)