Skip to content

Commit eb86d9d

Browse files
committed
Chore: Use turbo to run linting
1 parent 59f8506 commit eb86d9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+283
-146
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,11 @@ jobs:
4949
node-version: 20
5050
cache: 'yarn'
5151
- run: yarn install --immutable --immutable-cache
52-
- run: yarn tsc
53-
- run: yarn oxlint .
54-
- run: yarn prettier --check .
55-
- run: yarn eslint .
52+
- run: yarn turbo tsc lint
5653
- name: Validate package setup
5754
run: |
5855
yarn setup
59-
yarn prettier --write .
56+
yarn nano-staged
6057
git diff --exit-code -- . :^.yarn
6158
6259
Unit:

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.yarn
33
.tshy
44
coverage
5+
dist

eslint.config.js

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,3 @@
1-
// @ts-check
2-
import eslint from '@eslint/js';
3-
import globals from 'globals';
4-
import tseslint from 'typescript-eslint';
5-
import nodePlugin from 'eslint-plugin-n';
6-
import oxlint from 'eslint-plugin-oxlint';
1+
import config from '@repo/eslint-config';
72

8-
export default tseslint.config(
9-
{
10-
ignores: [
11-
'.git',
12-
'node_modules',
13-
'coverage',
14-
'.yarn',
15-
'packages/*/dist/**',
16-
'packages/*/node_modules/**',
17-
'packages/*/__snapshots__/**',
18-
],
19-
},
20-
eslint.configs.recommended,
21-
nodePlugin.configs['flat/recommended-module'],
22-
{
23-
languageOptions: {
24-
globals: {
25-
...globals.nodeBuiltin,
26-
},
27-
},
28-
rules: {
29-
'n/hashbang': 'off',
30-
'unicorn/consistent-function-scoping': 'off',
31-
'unicorn/filename-case': 'off',
32-
'unicorn/no-array-callback-reference': 'off',
33-
'unicorn/no-array-for-each': 'off',
34-
'unicorn/no-array-reduce': 'off',
35-
'unicorn/no-null': 'off',
36-
'unicorn/no-process-exit': 'off',
37-
'unicorn/prefer-event-target': 'off',
38-
'unicorn/prefer-top-level-await': 'off',
39-
'unicorn/prevent-abbreviations': 'off',
40-
},
41-
},
42-
{
43-
files: ['**/*.mts', '**/*.ts'],
44-
extends: [...tseslint.configs.strictTypeChecked],
45-
languageOptions: {
46-
parserOptions: {
47-
projectService: true,
48-
},
49-
},
50-
rules: {
51-
'@typescript-eslint/restrict-template-expressions': 'off',
52-
'@typescript-eslint/no-invalid-void-type': 'off',
53-
'@typescript-eslint/no-non-null-assertion': 'off',
54-
'@typescript-eslint/no-confusing-void-expression': 'off',
55-
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
56-
},
57-
},
58-
{
59-
files: ['**/*.cjs'],
60-
extends: [nodePlugin.configs['flat/recommended-script']],
61-
languageOptions: {
62-
globals: {
63-
...globals.node,
64-
},
65-
},
66-
},
67-
{
68-
files: ['packages/inquirer/test/**', 'packages/**/*.test.*'],
69-
rules: {
70-
'@typescript-eslint/unbound-method': 'off',
71-
'n/no-extraneous-import': [
72-
'error',
73-
{
74-
allowModules: ['vitest'],
75-
},
76-
],
77-
'n/no-extraneous-require': [
78-
'error',
79-
{
80-
allowModules: ['vitest'],
81-
},
82-
],
83-
'n/no-unsupported-features/node-builtins': [
84-
'error',
85-
{
86-
version: '>=22.0.0',
87-
},
88-
],
89-
},
90-
},
91-
{
92-
files: [
93-
'tools/**',
94-
'integration/**',
95-
'packages/inquirer/examples/**',
96-
'packages/demo/**',
97-
],
98-
rules: {
99-
'n/no-unsupported-features/node-builtins': [
100-
'error',
101-
{
102-
version: '>=22.0.0',
103-
},
104-
],
105-
},
106-
},
107-
...oxlint.configs['flat/recommended'],
108-
);
3+
export default config;

internals/eslint-config/index.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// @ts-check
2+
import eslint from '@eslint/js';
3+
import globals from 'globals';
4+
import tseslint from 'typescript-eslint';
5+
import nodePlugin from 'eslint-plugin-n';
6+
import oxlint from 'eslint-plugin-oxlint';
7+
8+
export default tseslint.config(
9+
{
10+
ignores: [
11+
'.git',
12+
'node_modules',
13+
'coverage',
14+
'.yarn',
15+
'**/dist/**',
16+
'**/node_modules/**',
17+
'**/__snapshots__/**',
18+
],
19+
},
20+
eslint.configs.recommended,
21+
nodePlugin.configs['flat/recommended-module'],
22+
{
23+
languageOptions: {
24+
globals: {
25+
...globals.nodeBuiltin,
26+
},
27+
},
28+
rules: {
29+
'n/hashbang': 'off',
30+
'unicorn/consistent-function-scoping': 'off',
31+
'unicorn/filename-case': 'off',
32+
'unicorn/no-array-callback-reference': 'off',
33+
'unicorn/no-array-for-each': 'off',
34+
'unicorn/no-array-reduce': 'off',
35+
'unicorn/no-null': 'off',
36+
'unicorn/no-process-exit': 'off',
37+
'unicorn/prefer-event-target': 'off',
38+
'unicorn/prefer-top-level-await': 'off',
39+
'unicorn/prevent-abbreviations': 'off',
40+
},
41+
},
42+
{
43+
files: ['**/*.mts', '**/*.ts'],
44+
extends: [...tseslint.configs.strictTypeChecked],
45+
languageOptions: {
46+
parserOptions: {
47+
projectService: true,
48+
},
49+
},
50+
rules: {
51+
'@typescript-eslint/restrict-template-expressions': 'off',
52+
'@typescript-eslint/no-invalid-void-type': 'off',
53+
'@typescript-eslint/no-non-null-assertion': 'off',
54+
'@typescript-eslint/no-confusing-void-expression': 'off',
55+
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
56+
},
57+
},
58+
{
59+
files: ['**/*.cjs'],
60+
extends: [nodePlugin.configs['flat/recommended-script']],
61+
languageOptions: {
62+
globals: {
63+
...globals.node,
64+
},
65+
},
66+
},
67+
{
68+
files: ['**/test/**', '**/*.test.*', 'tools/**', 'packages/inquirer/examples/**'],
69+
rules: {
70+
'@typescript-eslint/unbound-method': 'off',
71+
'n/no-extraneous-import': [
72+
'error',
73+
{
74+
allowModules: ['vitest'],
75+
},
76+
],
77+
'n/no-unsupported-features/node-builtins': [
78+
'error',
79+
{
80+
version: '>=22.0.0',
81+
},
82+
],
83+
},
84+
},
85+
...oxlint.configs['flat/recommended'],
86+
);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@repo/eslint-config",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"main": "index.js",
7+
"dependencies": {
8+
"@eslint/js": "^9.31.0",
9+
"eslint-config-prettier": "^10.1.8",
10+
"eslint-plugin-n": "^17.21.0",
11+
"eslint-plugin-oxlint": "^1.7.0",
12+
"globals": "^16.3.0",
13+
"typescript-eslint": "^8.37.0"
14+
}
15+
}

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"prepack": "find packages/* -maxdepth 1 -type f -name 'README*' -exec sed -i '' -e 's/utm_source=github/utm_source=npmjs/g' {} + && find packages/* -maxdepth 1 -type f -name package.json -exec sh -c 'jq \".devDependencies |= with_entries(select(.value != \\\"workspace:*\\\"))\" \"$1\" > \"$1.tmp\" && mv \"$1.tmp\" \"$1\"' _ {} \\;",
6060
"postpack": "git restore packages/*/package.json packages/*/README.md",
6161
"setup": "node ./tools/setup-packages.mjs",
62-
"pretest": "turbo tsc && oxlint && prettier --check . && eslint . && yarn tsc:test",
62+
"pretest": "turbo tsc lint && yarn tsc:test",
6363
"test": "vitest --run packages && node --test integration/**/*.test.*",
6464
"tsc": "turbo tsc",
6565
"tsc:test": "tsc -p tsconfig.json"
@@ -75,17 +75,13 @@
7575
"type-fest": "^4.0.0"
7676
},
7777
"devDependencies": {
78-
"@eslint/js": "^9.31.0",
78+
"@repo/eslint-config": "workspace:*",
7979
"@repo/hoist-peer-dependencies": "workspace:*",
8080
"@repo/tsconfig": "workspace:*",
8181
"@types/node": "^24.0.15",
8282
"@vitest/coverage-v8": "^3.2.4",
8383
"@vitest/ui": "^3.2.4",
8484
"eslint": "^9.31.0",
85-
"eslint-config-prettier": "^10.1.8",
86-
"eslint-plugin-n": "^17.21.0",
87-
"eslint-plugin-oxlint": "^1.7.0",
88-
"globals": "^16.3.0",
8985
"globby": "^14.1.0",
9086
"husky": "^9.1.7",
9187
"lerna": "^8.2.3",
@@ -94,7 +90,6 @@
9490
"prettier": "^3.6.2",
9591
"turbo": "^2.5.5",
9692
"typescript": "^5.8.3",
97-
"typescript-eslint": "^8.37.0",
9893
"vitest": "^3.2.4"
9994
},
10095
"packageManager": "yarn@4.7.0+sha512.5a0afa1d4c1d844b3447ee3319633797bcd6385d9a44be07993ae52ff4facabccafb4af5dcd1c2f9a94ac113e5e9ff56f6130431905884414229e284e37bb7c9",

packages/checkbox/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from '@repo/eslint-config';
2+
3+
export default config;

packages/checkbox/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
],
7272
"scripts": {
7373
"attw": "attw --pack",
74-
"tsc": "tshy"
74+
"tsc": "tshy",
75+
"lint": "oxlint --config=../../.oxlintrc.json && eslint . && prettier . --check --config=../../.prettierrc.mjs --ignore-path=../../.prettierignore"
7576
},
7677
"dependencies": {
7778
"@inquirer/core": "^10.1.14",
@@ -83,6 +84,7 @@
8384
"devDependencies": {
8485
"@arethetypeswrong/cli": "^0.18.2",
8586
"@inquirer/testing": "^2.1.48",
87+
"@repo/eslint-config": "workspace:*",
8688
"@repo/tsconfig": "workspace:*",
8789
"tshy": "^3.0.2"
8890
},

packages/confirm/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from '@repo/eslint-config';
2+
3+
export default config;

packages/confirm/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
],
7272
"scripts": {
7373
"attw": "attw --pack",
74-
"tsc": "tshy"
74+
"tsc": "tshy",
75+
"lint": "oxlint --config=../../.oxlintrc.json && eslint . && prettier . --check --config=../../.prettierrc.mjs --ignore-path=../../.prettierignore"
7576
},
7677
"dependencies": {
7778
"@inquirer/core": "^10.1.14",
@@ -80,6 +81,7 @@
8081
"devDependencies": {
8182
"@arethetypeswrong/cli": "^0.18.2",
8283
"@inquirer/testing": "^2.1.48",
84+
"@repo/eslint-config": "workspace:*",
8385
"@repo/tsconfig": "workspace:*",
8486
"tshy": "^3.0.2"
8587
},

0 commit comments

Comments
 (0)