@ntnyq/eslint-config 3.10.2 → 3.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -5
- package/dist/index.cjs +11 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- Opinionable: single quotes, no semi, trailing comma, etc
|
|
12
|
+
- Opinionable: single quotes, no semi, trailing comma, etc
|
|
13
13
|
- Designed to work alongside with [Prettier](https://prettier.io)
|
|
14
14
|
- Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
|
|
15
|
-
- Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML etc
|
|
15
|
+
- Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG and etc
|
|
16
16
|
- Strict but provides useful rules to guard your codebase
|
|
17
|
+
- Custom ESLint commands for [eslint-plugin-command](https://github.com/antfu/eslint-plugin-command)
|
|
17
18
|
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.5.0+
|
|
18
19
|
|
|
19
20
|
## Install
|
|
@@ -27,23 +28,57 @@ pnpm add eslint prettier typescript @ntnyq/eslint-config @ntnyq/prettier-config
|
|
|
27
28
|
Highly recommended using **`eslint.config.mjs`** as the config file :
|
|
28
29
|
|
|
29
30
|
```js
|
|
31
|
+
// @ts-check
|
|
32
|
+
|
|
30
33
|
import { defineESLintConfig } from '@ntnyq/eslint-config'
|
|
31
34
|
|
|
32
35
|
export default defineESLintConfig()
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
Add scripts `lint` in `package.json
|
|
38
|
+
Add scripts `lint` in `package.json`:
|
|
36
39
|
|
|
37
40
|
```json
|
|
38
41
|
{
|
|
39
42
|
"scripts": {
|
|
40
43
|
"lint": "eslint .",
|
|
41
44
|
"lint:fix": "eslint . --fix"
|
|
42
|
-
}
|
|
43
|
-
"prettier": "@ntnyq/prettier-config"
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
49
|
+
<details>
|
|
50
|
+
<summary>💼 Intergrated with Prettier, VSCode, husky and nano-staged</summary>
|
|
51
|
+
|
|
52
|
+
<br>
|
|
53
|
+
|
|
54
|
+
## Prettier config
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
// @ts-check
|
|
58
|
+
|
|
59
|
+
import { config, defineConfig } from '@ntnyq/prettier-config'
|
|
60
|
+
|
|
61
|
+
export default defineConfig({
|
|
62
|
+
...config,
|
|
63
|
+
|
|
64
|
+
// overrides if needed
|
|
65
|
+
overrides: [
|
|
66
|
+
{
|
|
67
|
+
files: ['**/*.html'],
|
|
68
|
+
options: {
|
|
69
|
+
singleAttributePerLine: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
files: ['**/*.{css,scss,less}'],
|
|
74
|
+
options: {
|
|
75
|
+
singleQuote: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
47
82
|
## VSCode Config
|
|
48
83
|
|
|
49
84
|
```json
|
|
@@ -99,6 +134,8 @@ pnpm add husky nano-staged -D
|
|
|
99
134
|
echo "nano-staged" > .husky/pre-commit
|
|
100
135
|
```
|
|
101
136
|
|
|
137
|
+
</details>
|
|
138
|
+
|
|
102
139
|
## Advanced config
|
|
103
140
|
|
|
104
141
|
Check for detail in:
|
package/dist/index.cjs
CHANGED
|
@@ -1791,7 +1791,7 @@ var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
|
1791
1791
|
var import_commands = require("eslint-plugin-command/commands");
|
|
1792
1792
|
var regexper = (0, import_commands.defineCommand)({
|
|
1793
1793
|
name: "regexper",
|
|
1794
|
-
// @regexper https://regexper.com
|
|
1794
|
+
// @regexper https://regexper.com/#%2F(%5Cb%7C%5Cs%7C%5E)(%40regexper)(%5Cs%5CS%2B)%3F(%5Cb%7C%5Cs%7C%24)%2F
|
|
1795
1795
|
match: /(\b|\s|^)(@regexper)(\s\S+)?(\b|\s|$)/,
|
|
1796
1796
|
action(ctx) {
|
|
1797
1797
|
const literal = ctx.findNodeBelow((node2) => {
|
|
@@ -1800,8 +1800,16 @@ var regexper = (0, import_commands.defineCommand)({
|
|
|
1800
1800
|
if (!literal) {
|
|
1801
1801
|
return ctx.reportError("Unable to find a regexp literal to generate");
|
|
1802
1802
|
}
|
|
1803
|
-
const [
|
|
1804
|
-
|
|
1803
|
+
const [
|
|
1804
|
+
// non-use
|
|
1805
|
+
_fullStr = "",
|
|
1806
|
+
spaceBefore = "",
|
|
1807
|
+
commandStr = "",
|
|
1808
|
+
existingUrl = "",
|
|
1809
|
+
// non-use
|
|
1810
|
+
_spaceAfter = ""
|
|
1811
|
+
] = ctx.matches;
|
|
1812
|
+
const url = `https://regexper.com/#${encodeURIComponent(literal.raw)}`;
|
|
1805
1813
|
if (existingUrl.trim() === url.trim()) {
|
|
1806
1814
|
return;
|
|
1807
1815
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -9800,7 +9800,7 @@ type TypescriptEslintConsistentTypeAssertions = [] | [
|
|
|
9800
9800
|
({
|
|
9801
9801
|
assertionStyle: "never";
|
|
9802
9802
|
} | {
|
|
9803
|
-
assertionStyle
|
|
9803
|
+
assertionStyle?: ("as" | "angle-bracket");
|
|
9804
9804
|
objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never");
|
|
9805
9805
|
})
|
|
9806
9806
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -9800,7 +9800,7 @@ type TypescriptEslintConsistentTypeAssertions = [] | [
|
|
|
9800
9800
|
({
|
|
9801
9801
|
assertionStyle: "never";
|
|
9802
9802
|
} | {
|
|
9803
|
-
assertionStyle
|
|
9803
|
+
assertionStyle?: ("as" | "angle-bracket");
|
|
9804
9804
|
objectLiteralTypeAssertions?: ("allow" | "allow-as-parameter" | "never");
|
|
9805
9805
|
})
|
|
9806
9806
|
];
|
package/dist/index.js
CHANGED
|
@@ -1635,7 +1635,7 @@ import createCommandConfig from "eslint-plugin-command/config";
|
|
|
1635
1635
|
import { defineCommand } from "eslint-plugin-command/commands";
|
|
1636
1636
|
var regexper = defineCommand({
|
|
1637
1637
|
name: "regexper",
|
|
1638
|
-
// @regexper https://regexper.com
|
|
1638
|
+
// @regexper https://regexper.com/#%2F(%5Cb%7C%5Cs%7C%5E)(%40regexper)(%5Cs%5CS%2B)%3F(%5Cb%7C%5Cs%7C%24)%2F
|
|
1639
1639
|
match: /(\b|\s|^)(@regexper)(\s\S+)?(\b|\s|$)/,
|
|
1640
1640
|
action(ctx) {
|
|
1641
1641
|
const literal = ctx.findNodeBelow((node2) => {
|
|
@@ -1644,8 +1644,16 @@ var regexper = defineCommand({
|
|
|
1644
1644
|
if (!literal) {
|
|
1645
1645
|
return ctx.reportError("Unable to find a regexp literal to generate");
|
|
1646
1646
|
}
|
|
1647
|
-
const [
|
|
1648
|
-
|
|
1647
|
+
const [
|
|
1648
|
+
// non-use
|
|
1649
|
+
_fullStr = "",
|
|
1650
|
+
spaceBefore = "",
|
|
1651
|
+
commandStr = "",
|
|
1652
|
+
existingUrl = "",
|
|
1653
|
+
// non-use
|
|
1654
|
+
_spaceAfter = ""
|
|
1655
|
+
] = ctx.matches;
|
|
1656
|
+
const url = `https://regexper.com/#${encodeURIComponent(literal.raw)}`;
|
|
1649
1657
|
if (existingUrl.trim() === url.trim()) {
|
|
1650
1658
|
return;
|
|
1651
1659
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.10.
|
|
4
|
+
"version": "3.10.3",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
7
7
|
"keywords": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@eslint/js": "^9.17.0",
|
|
60
60
|
"@eslint/markdown": "^6.2.1",
|
|
61
61
|
"@stylistic/eslint-plugin": "^2.12.1",
|
|
62
|
-
"@unocss/eslint-plugin": "^0.65.
|
|
62
|
+
"@unocss/eslint-plugin": "^0.65.3",
|
|
63
63
|
"@vitest/eslint-plugin": "^1.1.20",
|
|
64
64
|
"eslint-config-flat-gitignore": "^0.3.0",
|
|
65
65
|
"eslint-flat-config-utils": "^0.4.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"eslint-plugin-pinia": "^0.4.1",
|
|
81
81
|
"eslint-plugin-prettier": "^5.2.1",
|
|
82
82
|
"eslint-plugin-regexp": "^2.7.0",
|
|
83
|
-
"eslint-plugin-svgo": "^0.
|
|
83
|
+
"eslint-plugin-svgo": "^0.3.1",
|
|
84
84
|
"eslint-plugin-toml": "^0.12.0",
|
|
85
85
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
86
86
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"local-pkg": "^0.5.1",
|
|
93
93
|
"prettier": "^3.4.2",
|
|
94
94
|
"toml-eslint-parser": "^0.10.0",
|
|
95
|
-
"typescript-eslint": "^8.18.
|
|
95
|
+
"typescript-eslint": "^8.18.2",
|
|
96
96
|
"vue-eslint-parser": "^9.4.3",
|
|
97
97
|
"yaml-eslint-parser": "^1.2.3"
|
|
98
98
|
},
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"tsx": "^4.19.2",
|
|
111
111
|
"typescript": "^5.7.2",
|
|
112
112
|
"vitest": "^3.0.0-beta.3",
|
|
113
|
-
"zx": "^8.
|
|
113
|
+
"zx": "^8.3.0"
|
|
114
114
|
},
|
|
115
115
|
"engines": {
|
|
116
116
|
"node": ">=18.18.0"
|