Skip to content

Commit bcfd3fc

Browse files
committed
feat: new rule overrides, plugin syncs, and TS 5.8 support
1 parent 61015c2 commit bcfd3fc

37 files changed

+2415
-2124
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
node-version: lts/*
2525

2626
- name: Setup
27-
run: npm i -g @kirklin/ni
27+
run: npm i -g @antfu/ni
2828

2929
- name: Install
3030
run: nci
@@ -59,7 +59,7 @@ jobs:
5959
node-version: ${{ matrix.node }}
6060

6161
- name: Setup
62-
run: npm i -g @kirklin/ni
62+
run: npm i -g @antfu/ni
6363

6464
- name: Install
6565
run: nci

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
- Optional [formatters](#formatters) support for formatting CSS, HTML, XML, etc.
3434
- **Style principle**: Minimal for reading, stable for diff, consistent
3535
- Sorted imports, dangling commas
36-
- Single quotes, no semi
36+
- double quotes, no semi
3737
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
3838
- Respects `.gitignore` by default
3939
- Requires ESLint v9.5.0+
@@ -112,8 +112,8 @@ For example:
112112
```json
113113
{
114114
"scripts": {
115-
"lint": "eslint .",
116-
"lint:fix": "eslint . --fix"
115+
"lint": "eslint",
116+
"lint:fix": "eslint --fix"
117117
}
118118
}
119119
```
@@ -555,6 +555,27 @@ export default kirklin({
555555

556556
As it's in maintenance mode, we only accept bug fixes for Vue 2. It might also be removed in the future when `eslint-plugin-vue` drops support for Vue 2. We recommend upgrading to Vue 3 if possible.
557557

558+
#### Vue Accessibility
559+
560+
To enable Vue accessibility support, you need to explicitly turn it on:
561+
562+
```js
563+
// eslint.config.js
564+
import kirklin from "@kirklin/eslint-config";
565+
566+
export default kirklin({
567+
vue: {
568+
a11y: true
569+
},
570+
});
571+
```
572+
573+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
574+
575+
```bash
576+
npm i -D eslint-plugin-vuejs-accessibility
577+
```
578+
558579
### Optional Configs
559580

560581
We provide some optional configs for specific use cases, that we don't include their dependencies by default.

README.zh-cn.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
- 可选的[格式化程序](#formatters)支持CSS,HTML,XML等。
4141
- **样式原则**:最小化阅读,稳定的差异性,保持一致性
4242

43-
> [!NOTE]
44-
> 自 v1.0.0 版本起,该配置已重写为新的 [ESLint Flat 配置](https://eslint.org/docs/latest/use/configure/configuration-files-new),详细信息请查看 [发布说明](https://github.com/kirklin/eslint-config/releases/tag/v1.0.0)
45-
>
46-
> 自 v2.7.0 版本起,现要求使用 ESLint v9.5.0 及以上版本。
43+
> [!NOTE]
44+
> 自 v1.0.0 版本起,该配置已重写为新的 [ESLint Flat 配置](https://eslint.org/docs/latest/use/configure/configuration-files-new),详细信息请查看 [发布说明](https://github.com/kirklin/eslint-config/releases/tag/v1.0.0)
45+
>
46+
> 自 v2.7.0 版本起,现要求使用 ESLint v9.5.0 及以上版本。
4747
4848
## 使用方法
4949

@@ -747,17 +747,17 @@ export default kirklin({
747747
});
748748
```
749749

750-
### 编辑器特定的禁用规则
750+
### 编辑器特定的禁用规则
751751

752-
当 ESLint 在代码编辑器中运行时,以下规则的自动修复功能被禁用:
752+
当 ESLint 在代码编辑器中运行时,以下规则的自动修复功能被禁用:
753753

754-
- [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
755-
- [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
756-
- [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
754+
- [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
755+
- [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
756+
- [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
757757

758-
自 v3.0.0 版本起,这些规则不再被完全禁用,而是通过 [此辅助工具](https://github.com/antfu/eslint-flat-config-utils#composerdisablerulesfix) 设为不可自动修复。
758+
自 v3.0.0 版本起,这些规则不再被完全禁用,而是通过 [此辅助工具](https://github.com/antfu/eslint-flat-config-utils#composerdisablerulesfix) 设为不可自动修复。
759759

760-
这样可以防止编辑器在重构代码时自动删除未使用的导入,以提供更好的开发体验。这些规则仍然会在你通过终端运行 ESLint 或使用 [Lint Staged](#lint-staged) 时生效。
760+
这样可以防止编辑器在重构代码时自动删除未使用的导入,以提供更好的开发体验。这些规则仍然会在你通过终端运行 ESLint 或使用 [Lint Staged](#lint-staged) 时生效。
761761

762762
如果你不希望有这种行为,你可以手动禁用它们。
763763

eslint.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ import { kirklin } from "./src";
55

66
export default kirklin(
77
{
8-
vue: true,
8+
vue: {
9+
a11y: true,
10+
},
911
react: true,
1012
solid: true,
1113
svelte: true,
1214
astro: true,
1315
typescript: true,
1416
formatters: true,
17+
pnpm: true,
1518
type: "lib",
1619
},
1720
{
1821
ignores: [
1922
"fixtures",
2023
"_fixtures",
24+
"**/constants-generated.ts",
2125
],
2226
},
2327
{

fixtures/input/typescript.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,13 @@ var fn = (): string => {
7878

7979
log(car1, car2, favoriteFruit, numericValue, fn())
8080

81+
// Generator
82+
export function* generator1() {
83+
let id = 0;
84+
while (id < 100) {
85+
yield id++;
86+
}
87+
}
88+
export function * generator2() {
89+
yield* generator1()
90+
}

fixtures/output/all/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

fixtures/output/no-markdown-with-formatters/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

fixtures/output/no-style/typescript.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,13 @@ const fn = (): string => {
7878

7979
log(car1, car2, favoriteFruit, numericValue, fn())
8080

81+
// Generator
82+
export function* generator1() {
83+
let id = 0;
84+
while (id < 100) {
85+
yield id++;
86+
}
87+
}
88+
export function * generator2() {
89+
yield* generator1()
90+
}

fixtures/output/tab-double-quotes/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

fixtures/output/ts-override/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

fixtures/output/ts-strict-with-react/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

fixtures/output/ts-strict/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

fixtures/output/with-formatters/typescript.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ function fn(): string {
8282
}
8383

8484
log(car1, car2, favoriteFruit, numericValue, fn())
85+
86+
// Generator
87+
export function* generator1() {
88+
let id = 0
89+
while (id < 100) {
90+
yield id++
91+
}
92+
}
93+
export function* generator2() {
94+
yield* generator1()
95+
}

0 commit comments

Comments
 (0)