@ntnyq/eslint-config 3.0.0-beta.1 → 3.0.0-beta.11

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 CHANGED
@@ -14,7 +14,7 @@ pnpm add eslint prettier typescript @ntnyq/eslint-config @ntnyq/prettier-config
14
14
 
15
15
  ## Usage
16
16
 
17
- Config in `eslint.config.{mjs,mts}`:
17
+ Highly recommended for using `eslint.config.mjs` as the config file :
18
18
 
19
19
  ```js
20
20
  import { ntnyq } from '@ntnyq/eslint-config'
@@ -22,12 +22,138 @@ import { ntnyq } from '@ntnyq/eslint-config'
22
22
  export default ntnyq()
23
23
  ```
24
24
 
25
- Config in `eslint.config.{cjs,cts}`
25
+ Add scripts `lint` in `package.json`:
26
26
 
27
- ```js
28
- const ntnyq = require('@ntnyq/eslint-config')
27
+ ```json
28
+ {
29
+ "scripts": {
30
+ "lint": "eslint .",
31
+ "lint:fix": "eslint . --fix"
32
+ }
33
+ }
34
+ ```
35
+
36
+ ## VSCode Config
37
+
38
+ ```json
39
+ {
40
+ "eslint.enable": true,
41
+ "prettier.enable": true,
42
+ "editor.formatOnSave": true,
43
+ "editor.codeActionsOnSave": {
44
+ "source.fixAll.eslint": "explicit"
45
+ },
46
+ "eslint.validate": [
47
+ "vue",
48
+ "html",
49
+ "yaml",
50
+ "toml",
51
+ "json",
52
+ "jsonc",
53
+ "json5",
54
+ "markdown",
55
+ "javascript",
56
+ "typescript",
57
+ "javascriptreact",
58
+ "typescriptreact"
59
+ ]
60
+ }
61
+ ```
62
+
63
+ ## Lint changed files only
64
+
65
+ ### 1. Add dependencies
66
+
67
+ ```bash
68
+ pnpm add husky nano-staged -D
69
+ ```
70
+
71
+ ### 2. Config `package.json`
72
+
73
+ ```json
74
+ {
75
+ "scripts": {
76
+ "prepare": "husky"
77
+ },
78
+ "nano-staged": {
79
+ "*.{js,ts,cjs,mjs,vue,md,yml,yaml,json,html}": "eslint --fix"
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### 3. Add a hook
85
+
86
+ ```bash
87
+ echo "nano-staged" > .husky/pre-commit
88
+ ```
89
+
90
+ ## Advanced config
91
+
92
+ Check for detail in:
93
+
94
+ - [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
95
+ - [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
96
+
97
+ ### Config interface
98
+
99
+ ```typescript
100
+ export interface ConfigOptions {
101
+ sortTsConfig?: boolean
102
+
103
+ sortI18nLocale?: boolean
104
+
105
+ sortPackageJson?: boolean
106
+
107
+ ignores?: ConfigIgnoresOptions
108
+
109
+ command?: boolean | ConfigCommandOptions
110
+
111
+ gitignore?: boolean | ConfigGitIgnoreOptions
112
+
113
+ imports?: ConfigImportsOptions
114
+
115
+ node?: ConfigNodeOptions
116
+
117
+ javascript?: ConfigJavaScriptOptions
118
+
119
+ typescript?: boolean | ConfigTypeScriptOptions
120
+
121
+ unicorn?: boolean | ConfigUnicornOptions
122
+
123
+ prettier?: boolean | ConfigPrettierOptions
124
+
125
+ perfectionist?: boolean | ConfigPerfectionistOptions
126
+
127
+ /**
128
+ * @internal
129
+ */
130
+ unusedImports?: boolean | ConfigUnusedImportsOptions
131
+
132
+ /**
133
+ * @internal
134
+ */
135
+ antfu?: boolean | ConfigAntfuOptions
136
+
137
+ comments?: boolean | ConfigCommentsOptions
138
+
139
+ jsdoc?: boolean | ConfigJsdocOptions
140
+
141
+ unocss?: boolean | ConfigUnoCSSOptions
142
+
143
+ regexp?: boolean | ConfigRegexpOptions
144
+
145
+ jsonc?: boolean | ConfigJsoncOptions
146
+
147
+ yml?: boolean | ConfigYmlOptions
148
+
149
+ markdown?: boolean | ConfigMarkdownOptions
150
+
151
+ toml?: boolean | ConfigTomlOptions
152
+
153
+ vue?: boolean | ConfigVueOptions
29
154
 
30
- module.exports = ntnyq()
155
+ vitest?: boolean | ConfigVitestOptions
156
+ }
31
157
  ```
32
158
 
33
159
  ## Credits