Skip to content

Commit 770f331

Browse files
committed
Build eslint entrypoint
1 parent c90f54b commit 770f331

File tree

6 files changed

+199
-5
lines changed

6 files changed

+199
-5
lines changed

package-lock.json

Lines changed: 119 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
"types": "./dist/index.d.cts",
1616
"default": "./dist/index.cjs"
1717
}
18+
},
19+
"./eslint": {
20+
"import": {
21+
"types": "./eslint.d.ts",
22+
"default": "./eslint.js"
23+
},
24+
"require": {
25+
"types": "./dist/eslint.d.cts",
26+
"default": "./dist/eslint.cjs"
27+
}
1828
}
1929
},
2030
"module": "index.js",
@@ -34,6 +44,9 @@
3444
"index.js",
3545
"index.js.map",
3646
"index.d.ts",
47+
"eslint.js",
48+
"eslint.js.map",
49+
"eslint.d.ts",
3750
"lib",
3851
"src",
3952
"dist",
@@ -42,8 +55,8 @@
4255
],
4356
"scripts": {
4457
"build": "npm run build:entrypoints",
45-
"prebuild": "tsx src/index.ts",
46-
"postbuild": "node ./index.js",
58+
"prebuild": "concurrently --raw --group 'tsx src/index.ts' 'tsx src/eslint.ts'",
59+
"postbuild": "concurrently --raw --group 'node ./index.js' 'node ./eslint.js'",
4760
"build:entrypoints": "npm run build:ts",
4861
"postbuild:entrypoints": "tsup",
4962
"build:ts": "tsc --project tsconfig.build.json",
@@ -86,6 +99,7 @@
8699
"@swc/core": "^1.11.29",
87100
"ava": "^6.0.1",
88101
"c8": "^10.1.2",
102+
"concurrently": "^9.1.2",
89103
"del-cli": "^6.0.0",
90104
"eslint": "^8.9.0",
91105
"landlubber": "^2.0.0",

src/eslint.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export default {
2+
plugins: ['simple-import-sort', 'unused-imports'],
3+
parserOptions: {
4+
sourceType: 'module',
5+
ecmaVersion: 'latest',
6+
},
7+
rules: {
8+
'no-console': 'error',
9+
'unused-imports/no-unused-imports': 'error',
10+
'unused-imports/no-unused-vars': [
11+
'error',
12+
{
13+
vars: 'all',
14+
varsIgnorePattern: '^_',
15+
args: 'after-used',
16+
argsIgnorePattern: '^_',
17+
ignoreRestSiblings: true,
18+
},
19+
],
20+
'import/extensions': ['error', 'ignorePackages'],
21+
'import/no-duplicates': ['error', { 'prefer-inline': true }],
22+
'import/no-relative-parent-imports': 'error',
23+
'simple-import-sort/imports': [
24+
'error',
25+
{
26+
groups: [
27+
['^\\u0000'],
28+
['^node:'],
29+
['^@?\\w'],
30+
['^lib/'],
31+
['^'],
32+
['^\\.'],
33+
],
34+
},
35+
],
36+
'simple-import-sort/exports': 'error',
37+
},
38+
overrides: [
39+
{
40+
files: ['*.js', '*.mjs', '*.cjs'],
41+
extends: ['standard', 'prettier'],
42+
},
43+
{
44+
files: ['*.ts', '*.tsx'],
45+
extends: ['standard-with-typescript', 'prettier'],
46+
parserOptions: {
47+
project: './tsconfig.json',
48+
},
49+
rules: {
50+
'@typescript-eslint/no-import-type-side-effects': 'error',
51+
'@typescript-eslint/consistent-type-imports': [
52+
'error',
53+
{
54+
fixStyle: 'inline-type-imports',
55+
},
56+
],
57+
'@typescript-eslint/no-unused-vars': 'off',
58+
},
59+
},
60+
],
61+
}

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"rootDir": "./src",
1010
"outDir": "./"
1111
},
12-
"files": ["src/index.ts"],
12+
"files": ["src/index.ts", "src/eslint.ts"],
1313
"include": ["src/**/*"],
1414
"exclude": ["**/*.test.ts", "tsup.config.ts"]
1515
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"lib/*": ["./src/lib/*"]
2929
}
3030
},
31-
"files": ["src/index.ts"],
31+
"files": ["src/index.ts", "src/eslint.ts"],
3232
"include": ["src/**/*", "test/**/*", "examples/**/*", "tsup.config.ts"]
3333
}

tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig } from 'tsup'
22

33
export default defineConfig({
44
tsconfig: 'tsconfig.build.json',
5-
entry: ['src/index.ts'],
5+
entry: ['src/index.ts', 'src/eslint.ts'],
66
format: ['cjs'],
77
treeshake: true,
88
dts: true,

0 commit comments

Comments
 (0)