@ntnyq/eslint-config 3.0.0-beta.2 → 3.0.0-beta.20

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