eslint-plugin-nextjs 0.0.0 → 0.1.0
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 +9 -380
- package/dist/index.cjs +1494 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +43 -0
- package/dist/index.d.ts +42 -1
- package/dist/index.js +1455 -1
- package/dist/index.js.map +1 -1
- package/dist/rules/google-font-display.cjs +119 -0
- package/dist/rules/google-font-display.cjs.map +1 -0
- package/dist/rules/google-font-display.d.cts +8 -0
- package/dist/rules/google-font-display.d.ts +8 -0
- package/dist/rules/google-font-display.js +92 -0
- package/dist/rules/google-font-display.js.map +1 -0
- package/dist/rules/google-font-preconnect.cjs +109 -0
- package/dist/rules/google-font-preconnect.cjs.map +1 -0
- package/dist/rules/google-font-preconnect.d.cts +5 -0
- package/dist/rules/google-font-preconnect.d.ts +5 -0
- package/dist/rules/google-font-preconnect.js +82 -0
- package/dist/rules/google-font-preconnect.js.map +1 -0
- package/dist/rules/inline-script-id.cjs +94 -0
- package/dist/rules/inline-script-id.cjs.map +1 -0
- package/dist/rules/inline-script-id.d.cts +5 -0
- package/dist/rules/inline-script-id.d.ts +5 -0
- package/dist/rules/inline-script-id.js +67 -0
- package/dist/rules/inline-script-id.js.map +1 -0
- package/dist/rules/next-script-for-ga.cjs +129 -0
- package/dist/rules/next-script-for-ga.cjs.map +1 -0
- package/dist/rules/next-script-for-ga.d.cts +5 -0
- package/dist/rules/next-script-for-ga.d.ts +5 -0
- package/dist/rules/next-script-for-ga.js +102 -0
- package/dist/rules/next-script-for-ga.js.map +1 -0
- package/dist/rules/no-assign-module-variable.cjs +64 -0
- package/dist/rules/no-assign-module-variable.cjs.map +1 -0
- package/dist/rules/no-assign-module-variable.d.cts +5 -0
- package/dist/rules/no-assign-module-variable.d.ts +5 -0
- package/dist/rules/no-assign-module-variable.js +37 -0
- package/dist/rules/no-assign-module-variable.js.map +1 -0
- package/dist/rules/no-async-client-component.cjs +99 -0
- package/dist/rules/no-async-client-component.cjs.map +1 -0
- package/dist/rules/no-async-client-component.d.cts +5 -0
- package/dist/rules/no-async-client-component.d.ts +5 -0
- package/dist/rules/no-async-client-component.js +72 -0
- package/dist/rules/no-async-client-component.js.map +1 -0
- package/dist/rules/no-before-interactive-script-outside-document.cjs +94 -0
- package/dist/rules/no-before-interactive-script-outside-document.cjs.map +1 -0
- package/dist/rules/no-before-interactive-script-outside-document.d.cts +5 -0
- package/dist/rules/no-before-interactive-script-outside-document.d.ts +5 -0
- package/dist/rules/no-before-interactive-script-outside-document.js +59 -0
- package/dist/rules/no-before-interactive-script-outside-document.js.map +1 -0
- package/dist/rules/no-css-tags.cjs +70 -0
- package/dist/rules/no-css-tags.cjs.map +1 -0
- package/dist/rules/no-css-tags.d.cts +5 -0
- package/dist/rules/no-css-tags.d.ts +5 -0
- package/dist/rules/no-css-tags.js +43 -0
- package/dist/rules/no-css-tags.js.map +1 -0
- package/dist/rules/no-document-import-in-page.cjs +74 -0
- package/dist/rules/no-document-import-in-page.cjs.map +1 -0
- package/dist/rules/no-document-import-in-page.d.cts +5 -0
- package/dist/rules/no-document-import-in-page.d.ts +5 -0
- package/dist/rules/no-document-import-in-page.js +39 -0
- package/dist/rules/no-document-import-in-page.js.map +1 -0
- package/dist/rules/no-duplicate-head.cjs +87 -0
- package/dist/rules/no-duplicate-head.cjs.map +1 -0
- package/dist/rules/no-duplicate-head.d.cts +5 -0
- package/dist/rules/no-duplicate-head.d.ts +5 -0
- package/dist/rules/no-duplicate-head.js +60 -0
- package/dist/rules/no-duplicate-head.js.map +1 -0
- package/dist/rules/no-head-element.cjs +76 -0
- package/dist/rules/no-head-element.cjs.map +1 -0
- package/dist/rules/no-head-element.d.cts +5 -0
- package/dist/rules/no-head-element.d.ts +5 -0
- package/dist/rules/no-head-element.js +41 -0
- package/dist/rules/no-head-element.js.map +1 -0
- package/dist/rules/no-head-import-in-document.cjs +76 -0
- package/dist/rules/no-head-import-in-document.cjs.map +1 -0
- package/dist/rules/no-head-import-in-document.d.cts +5 -0
- package/dist/rules/no-head-import-in-document.d.ts +5 -0
- package/dist/rules/no-head-import-in-document.js +41 -0
- package/dist/rules/no-head-import-in-document.js.map +1 -0
- package/dist/rules/no-html-link-for-pages.cjs +302 -0
- package/dist/rules/no-html-link-for-pages.cjs.map +1 -0
- package/dist/rules/no-html-link-for-pages.d.cts +5 -0
- package/dist/rules/no-html-link-for-pages.d.ts +5 -0
- package/dist/rules/no-html-link-for-pages.js +267 -0
- package/dist/rules/no-html-link-for-pages.js.map +1 -0
- package/dist/rules/no-img-element.cjs +83 -0
- package/dist/rules/no-img-element.cjs.map +1 -0
- package/dist/rules/no-img-element.d.cts +5 -0
- package/dist/rules/no-img-element.d.ts +5 -0
- package/dist/rules/no-img-element.js +48 -0
- package/dist/rules/no-img-element.js.map +1 -0
- package/dist/rules/no-page-custom-font.cjs +184 -0
- package/dist/rules/no-page-custom-font.cjs.map +1 -0
- package/dist/rules/no-page-custom-font.d.cts +5 -0
- package/dist/rules/no-page-custom-font.d.ts +5 -0
- package/dist/rules/no-page-custom-font.js +159 -0
- package/dist/rules/no-page-custom-font.js.map +1 -0
- package/dist/rules/no-script-component-in-head.cjs +74 -0
- package/dist/rules/no-script-component-in-head.cjs.map +1 -0
- package/dist/rules/no-script-component-in-head.d.cts +5 -0
- package/dist/rules/no-script-component-in-head.d.ts +5 -0
- package/dist/rules/no-script-component-in-head.js +47 -0
- package/dist/rules/no-script-component-in-head.js.map +1 -0
- package/dist/rules/no-styled-jsx-in-document.cjs +78 -0
- package/dist/rules/no-styled-jsx-in-document.cjs.map +1 -0
- package/dist/rules/no-styled-jsx-in-document.d.cts +5 -0
- package/dist/rules/no-styled-jsx-in-document.d.ts +5 -0
- package/dist/rules/no-styled-jsx-in-document.js +43 -0
- package/dist/rules/no-styled-jsx-in-document.js.map +1 -0
- package/dist/rules/no-sync-scripts.cjs +64 -0
- package/dist/rules/no-sync-scripts.cjs.map +1 -0
- package/dist/rules/no-sync-scripts.d.cts +5 -0
- package/dist/rules/no-sync-scripts.d.ts +5 -0
- package/dist/rules/no-sync-scripts.js +37 -0
- package/dist/rules/no-sync-scripts.js.map +1 -0
- package/dist/rules/no-title-in-document-head.cjs +78 -0
- package/dist/rules/no-title-in-document-head.cjs.map +1 -0
- package/dist/rules/no-title-in-document-head.d.cts +5 -0
- package/dist/rules/no-title-in-document-head.d.ts +5 -0
- package/dist/rules/no-title-in-document-head.js +51 -0
- package/dist/rules/no-title-in-document-head.js.map +1 -0
- package/dist/rules/no-typos.cjs +133 -0
- package/dist/rules/no-typos.cjs.map +1 -0
- package/dist/rules/no-typos.d.cts +5 -0
- package/dist/rules/no-typos.d.ts +5 -0
- package/dist/rules/no-typos.js +98 -0
- package/dist/rules/no-typos.js.map +1 -0
- package/dist/rules/no-unwanted-polyfillio.cjs +164 -0
- package/dist/rules/no-unwanted-polyfillio.cjs.map +1 -0
- package/dist/rules/no-unwanted-polyfillio.d.cts +5 -0
- package/dist/rules/no-unwanted-polyfillio.d.ts +5 -0
- package/dist/rules/no-unwanted-polyfillio.js +137 -0
- package/dist/rules/no-unwanted-polyfillio.js.map +1 -0
- package/dist/utils/define-rule.cjs +31 -0
- package/dist/utils/define-rule.cjs.map +1 -0
- package/dist/utils/define-rule.d.cts +5 -0
- package/dist/utils/define-rule.d.ts +5 -0
- package/dist/utils/define-rule.js +6 -0
- package/dist/utils/define-rule.js.map +1 -0
- package/dist/utils/get-root-dirs.cjs +60 -0
- package/dist/utils/get-root-dirs.cjs.map +1 -0
- package/dist/utils/get-root-dirs.d.cts +8 -0
- package/dist/utils/get-root-dirs.d.ts +8 -0
- package/dist/utils/get-root-dirs.js +25 -0
- package/dist/utils/get-root-dirs.js.map +1 -0
- package/dist/utils/node-attributes.cjs +67 -0
- package/dist/utils/node-attributes.cjs.map +1 -0
- package/dist/utils/node-attributes.d.cts +15 -0
- package/dist/utils/node-attributes.d.ts +15 -0
- package/dist/utils/node-attributes.js +46 -0
- package/dist/utils/node-attributes.js.map +1 -0
- package/dist/utils/url.cjs +167 -0
- package/dist/utils/url.cjs.map +1 -0
- package/dist/utils/url.d.cts +35 -0
- package/dist/utils/url.d.ts +35 -0
- package/dist/utils/url.js +128 -0
- package/dist/utils/url.js.map +1 -0
- package/package.json +15 -2
package/README.md
CHANGED
@@ -1,402 +1,31 @@
|
|
1
|
-
# `
|
2
|
-
|
3
|
-
A zero-configuration style guide for ESLint and Prettier that provides sensible default settings and flexible configuration options.
|
1
|
+
# `eslint-plugin-nextjs`
|
4
2
|
|
5
3
|
[](https://github.com/drake-nathan/js-style-kit/actions/workflows/ci.yaml)
|
6
4
|
[](https://github.com/drake-nathan/js-style-kit/actions/workflows/release.yaml)
|
7
|
-
[](https://www.npmjs.com/package/eslint-plugin-nextjs)
|
8
6
|
[](https://opensource.org/licenses/MIT)
|
9
7
|
[](https://codecov.io/gh/drake-nathan/js-style-kit)
|
10
8
|

|
11
9
|
|
12
10
|
## Overview
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
- ✅ All dependencies included (ESLint, Prettier, plugins) - no need to install extras
|
17
|
-
- ✅ ESLint v9 flat config
|
18
|
-
- ✅ TypeScript support out of the box
|
19
|
-
- ✅ Optional React and React Compiler support
|
20
|
-
- ✅ JSDoc validation with configurable requirements for libraries
|
21
|
-
- ✅ Automatic import, prop, and object sorting with Perfectionist
|
22
|
-
- ✅ Tailwind CSS support for Prettier
|
23
|
-
- ✅ Modern ESM-only package
|
12
|
+
This is a unofficial fork of `@next/eslint-plugin-next` with TypeScript and ESLint v9 support. I have no association with Vercel or the Next.js team. I just needed an updated version of the plugin for my style guide, `js-style-kit`.
|
24
13
|
|
25
|
-
|
14
|
+
If you're using `eslint-config-next`, you _do not_ need this plugin.
|
15
|
+
You only need this plugin if you're rolling your own ESLint config.
|
26
16
|
|
27
17
|
## Requirements
|
28
18
|
|
29
19
|
- Node.js v20.11.0 or higher
|
30
|
-
- TypeScript (for TypeScript projects, not bundled)
|
31
20
|
|
32
21
|
## Installation
|
33
22
|
|
34
23
|
```bash
|
35
|
-
npm
|
24
|
+
npm i eslint-plugin-nextjs -D
|
36
25
|
# or
|
37
|
-
yarn add
|
26
|
+
yarn add eslint-plugin-nextjs -D
|
38
27
|
# or
|
39
|
-
pnpm add
|
28
|
+
pnpm add eslint-plugin-nextjs -D
|
40
29
|
# or
|
41
|
-
bun add
|
42
|
-
```
|
43
|
-
|
44
|
-
## ESLint Configuration
|
45
|
-
|
46
|
-
### Basic Usage
|
47
|
-
|
48
|
-
Create an `eslint.config.js` file in your project root:
|
49
|
-
|
50
|
-
```js
|
51
|
-
import { eslintConfig } from "js-style-kit";
|
52
|
-
|
53
|
-
export default eslintConfig();
|
54
|
-
```
|
55
|
-
|
56
|
-
> **Note:** If you're not using `"type": "module"` in your package.json, name your file `eslint.config.mjs` instead.
|
57
|
-
|
58
|
-
Setup your `package.json` commands:
|
59
|
-
|
60
|
-
```json
|
61
|
-
{
|
62
|
-
"scripts": {
|
63
|
-
"lint": "eslint . --max-warnings 0",
|
64
|
-
"lint:fix": "eslint . --fix --max-warnings 0"
|
65
|
-
}
|
66
|
-
}
|
67
|
-
```
|
68
|
-
|
69
|
-
> **Note:** The `--max-warnings 0` option is important because all rules are set to warning by default.
|
70
|
-
|
71
|
-
### Configuration Options
|
72
|
-
|
73
|
-
The `eslintConfig()` function accepts a configuration object with the following options:
|
74
|
-
|
75
|
-
```js
|
76
|
-
import { eslintConfig } from "js-style-kit";
|
77
|
-
|
78
|
-
export default eslintConfig({
|
79
|
-
// All options shown with their default values
|
80
|
-
functionStyle: "arrow", // Controls function style: "arrow", "declaration", "expression", or "off"
|
81
|
-
ignores: [], // Additional paths to ignore (node_modules and dist already excluded)
|
82
|
-
jsdoc: { requireJsdoc: false }, // JSDoc configuration or false to disable
|
83
|
-
react: false, // Whether to include React rules, see below for options
|
84
|
-
sorting: true, // Whether to include sorting rules from Perfectionist
|
85
|
-
storybook: false, // Whether to include Storybook rules
|
86
|
-
typescript: true, // Boolean or string path to tsconfig.json
|
87
|
-
});
|
30
|
+
bun add eslint-plugin-nextjs -d
|
88
31
|
```
|
89
|
-
|
90
|
-
#### Function Style Configuration
|
91
|
-
|
92
|
-
Controls how functions should be written. Some configurations are auto-fixable, but some require manual adjustment.
|
93
|
-
|
94
|
-
```js
|
95
|
-
// Enforce arrow functions (default)
|
96
|
-
functionStyle: "arrow";
|
97
|
-
|
98
|
-
// Enforce function declarations
|
99
|
-
functionStyle: "declaration";
|
100
|
-
|
101
|
-
// Enforce function expressions
|
102
|
-
functionStyle: "expression";
|
103
|
-
|
104
|
-
// Disable function style enforcement
|
105
|
-
functionStyle: "off";
|
106
|
-
```
|
107
|
-
|
108
|
-
#### TypeScript Configuration
|
109
|
-
|
110
|
-
TypeScript support is enabled by default. You can:
|
111
|
-
|
112
|
-
```js
|
113
|
-
// Enable with automatic project detection
|
114
|
-
typescript: true;
|
115
|
-
|
116
|
-
// Disable TypeScript rules
|
117
|
-
typescript: false;
|
118
|
-
|
119
|
-
// Specify path to your tsconfig.json
|
120
|
-
typescript: "./tsconfig.json";
|
121
|
-
```
|
122
|
-
|
123
|
-
#### React Configuration
|
124
|
-
|
125
|
-
React support is disabled by default.
|
126
|
-
|
127
|
-
```js
|
128
|
-
// `true` enables standard react rules, react hook rules, and react compiler
|
129
|
-
react: true
|
130
|
-
|
131
|
-
// you can also pass an object to control react compiler and next support
|
132
|
-
react: {
|
133
|
-
reactCompiler: false,
|
134
|
-
reactRefresh: false, // Controls React Fast Refresh validation (disabled by default)
|
135
|
-
next: true
|
136
|
-
}
|
137
|
-
// next simply adds ".next" to the ignores array, but I plan add the next plugin in the future
|
138
|
-
```
|
139
|
-
|
140
|
-
#### JSDoc Configuration
|
141
|
-
|
142
|
-
JSDoc validation is enabled by default, but requirement rules are off:
|
143
|
-
|
144
|
-
```js
|
145
|
-
// Disable JSDoc validation completely
|
146
|
-
jsdoc: false;
|
147
|
-
|
148
|
-
// Enable JSDoc with requirement rules, ideal for libraries
|
149
|
-
jsdoc: {
|
150
|
-
requireJsdoc: true;
|
151
|
-
}
|
152
|
-
```
|
153
|
-
|
154
|
-
#### Testing Configuration
|
155
|
-
|
156
|
-
Testing support is enabled by default with Vitest configuration. You can customize it or disable it completely:
|
157
|
-
|
158
|
-
```js
|
159
|
-
// Disable testing configuration
|
160
|
-
testing: false;
|
161
|
-
|
162
|
-
// Enable with custom options
|
163
|
-
testing: {
|
164
|
-
filenamePattern: "spec", // "test" (.test, default) or "spec" (.spec)
|
165
|
-
files: ["**/*.{test,spec}.{ts,tsx,js,jsx}"], // Override file patterns
|
166
|
-
formattingRules: true, // Whether to include formatting rules like padding around blocks
|
167
|
-
framework: "vitest", // "vitest" (default), "jest", "node", or "bun"
|
168
|
-
itOrTest: "test", // "it" (default) or "test"
|
169
|
-
}
|
170
|
-
```
|
171
|
-
|
172
|
-
#### Perfectionist (Code Organization)
|
173
|
-
|
174
|
-
Sorting/organization rules from the Perfectionist plugin are enabled by default:
|
175
|
-
|
176
|
-
```js
|
177
|
-
// Disable sorting rules
|
178
|
-
sorting: false;
|
179
|
-
```
|
180
|
-
|
181
|
-
#### Storybook Configuration
|
182
|
-
|
183
|
-
Storybook support is disabled by default, but can be enabled to provide linting rules specifically for Storybook files:
|
184
|
-
|
185
|
-
```js
|
186
|
-
// Enable Storybook rules
|
187
|
-
storybook: true;
|
188
|
-
```
|
189
|
-
|
190
|
-
When enabled, this configuration:
|
191
|
-
|
192
|
-
- Applies best practices for Storybook files (_.stories._ and _.story._)
|
193
|
-
- Includes rules for Storybook configuration files (.storybook/main.\*)
|
194
|
-
- Ensures the .storybook directory is not ignored by ESLint (adds a negation pattern to ignores)
|
195
|
-
|
196
|
-
### Adding Custom ESLint Configurations
|
197
|
-
|
198
|
-
You can extend the base configuration by providing additional ESLint config objects as rest parameters:
|
199
|
-
|
200
|
-
```js
|
201
|
-
import { eslintConfig } from "js-style-kit";
|
202
|
-
|
203
|
-
export default eslintConfig(
|
204
|
-
{
|
205
|
-
// Base configuration options
|
206
|
-
typescript: "tsconfig.eslint.json",
|
207
|
-
react: true,
|
208
|
-
},
|
209
|
-
// Additional custom ESLint configuration objects
|
210
|
-
{
|
211
|
-
name: "custom-globals",
|
212
|
-
languageOptions: {
|
213
|
-
globals: {
|
214
|
-
process: "readonly",
|
215
|
-
__dirname: "readonly",
|
216
|
-
},
|
217
|
-
},
|
218
|
-
},
|
219
|
-
{
|
220
|
-
name: "custom-rules",
|
221
|
-
rules: {
|
222
|
-
// Override or add specific rules
|
223
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
224
|
-
"max-len": ["warn", { code: 100 }],
|
225
|
-
quotes: ["error", "single"],
|
226
|
-
},
|
227
|
-
},
|
228
|
-
// Add as many additional configs as needed
|
229
|
-
);
|
230
|
-
```
|
231
|
-
|
232
|
-
## Prettier Configuration
|
233
|
-
|
234
|
-
### Basic Usage
|
235
|
-
|
236
|
-
Create a `prettier.config.js` file in your project root:
|
237
|
-
|
238
|
-
```js
|
239
|
-
import { prettierConfig } from "js-style-kit";
|
240
|
-
|
241
|
-
export default prettierConfig();
|
242
|
-
```
|
243
|
-
|
244
|
-
> **Note:** If you're not using `"type": "module"` in your package.json, name your file `prettier.config.mjs` instead.
|
245
|
-
|
246
|
-
Setup your `package.json` commands:
|
247
|
-
|
248
|
-
```json
|
249
|
-
{
|
250
|
-
"scripts": {
|
251
|
-
"format": "prettier --write .",
|
252
|
-
"format:check": "prettier --check ." // run this one in your CI
|
253
|
-
}
|
254
|
-
}
|
255
|
-
```
|
256
|
-
|
257
|
-
### Configuration Options
|
258
|
-
|
259
|
-
The `prettierConfig()` function accepts a configuration object with the following options:
|
260
|
-
|
261
|
-
```js
|
262
|
-
import { prettierConfig } from "js-style-kit";
|
263
|
-
|
264
|
-
export default prettierConfig({
|
265
|
-
// All options shown with their default values
|
266
|
-
cssOrderPlugin: true, // Enable CSS order plugin
|
267
|
-
curlyPlugin: true, // Enable curly braces enforcement for all control statements
|
268
|
-
jsonSortPlugin: true, // Enable JSON sorting plugin
|
269
|
-
packageJsonPlugin: true, // Enable package.json sorting plugin
|
270
|
-
tailwindPlugin: false, // Enable Tailwind CSS plugin (boolean, string[], or options object)
|
271
|
-
|
272
|
-
// You can also pass any standard Prettier options
|
273
|
-
printWidth: 80,
|
274
|
-
tabWidth: 2,
|
275
|
-
// etc.
|
276
|
-
});
|
277
|
-
```
|
278
|
-
|
279
|
-
#### Tailwind CSS Support
|
280
|
-
|
281
|
-
Tailwind CSS formatting is disabled by default. You can enable it in different ways:
|
282
|
-
|
283
|
-
```js
|
284
|
-
// Enable Tailwind with default utility functions (clsx, cva, cn)
|
285
|
-
tailwindPlugin: true
|
286
|
-
|
287
|
-
// Enable Tailwind with custom utility functions
|
288
|
-
tailwindPlugin: ["clsx", "cva", "cn", "myCustomFunction"]
|
289
|
-
|
290
|
-
// Enable Tailwind with custom options
|
291
|
-
tailwindPlugin: {
|
292
|
-
tailwindFunctions: ["clsx", "cva", "myCustomFunction"],
|
293
|
-
tailwindAttributes: ["tw"]
|
294
|
-
}
|
295
|
-
```
|
296
|
-
|
297
|
-
#### CSS Order Plugin
|
298
|
-
|
299
|
-
The CSS order plugin is enabled by default. It sorts CSS properties in a consistent order. You can disable it:
|
300
|
-
|
301
|
-
```js
|
302
|
-
// Disable CSS order plugin
|
303
|
-
cssOrderPlugin: false;
|
304
|
-
```
|
305
|
-
|
306
|
-
#### Curly Braces Enforcement
|
307
|
-
|
308
|
-
The curly braces plugin is disabled by default. It enforces consistent use of curly braces for all control flow statements (`if`, `for`, `while`, etc.), even for single-line statements. This is equivalent to ESLint's `curly` rule with the `all` option, but applied at the Prettier formatting level:
|
309
|
-
|
310
|
-
```diff
|
311
|
-
- if (abc) def;
|
312
|
-
+ if (abc) {
|
313
|
-
+ def;
|
314
|
-
+ }
|
315
|
-
```
|
316
|
-
|
317
|
-
You can disable it:
|
318
|
-
|
319
|
-
```js
|
320
|
-
// Disable curly braces enforcement
|
321
|
-
curlyPlugin: false;
|
322
|
-
```
|
323
|
-
|
324
|
-
#### JSON Sorting
|
325
|
-
|
326
|
-
The JSON sorting plugin is enabled by default. You can disable it or configure it:
|
327
|
-
|
328
|
-
```js
|
329
|
-
// Disable JSON sorting
|
330
|
-
jsonSortPlugin: false;
|
331
|
-
|
332
|
-
// Configure JSON sorting
|
333
|
-
jsonSortPlugin: {
|
334
|
-
jsonRecursiveSort: true;
|
335
|
-
// other plugin options...
|
336
|
-
}
|
337
|
-
```
|
338
|
-
|
339
|
-
#### Standard Prettier Options
|
340
|
-
|
341
|
-
You can pass any standard Prettier options directly:
|
342
|
-
|
343
|
-
```js
|
344
|
-
import { prettierConfig } from "js-style-kit";
|
345
|
-
|
346
|
-
export default prettierConfig({
|
347
|
-
// Enable Tailwind
|
348
|
-
tailwindPlugin: true,
|
349
|
-
|
350
|
-
// Standard Prettier options
|
351
|
-
printWidth: 100,
|
352
|
-
tabWidth: 2,
|
353
|
-
useTabs: false,
|
354
|
-
semi: true,
|
355
|
-
singleQuote: false,
|
356
|
-
trailingComma: "all",
|
357
|
-
bracketSpacing: true,
|
358
|
-
endOfLine: "lf",
|
359
|
-
});
|
360
|
-
```
|
361
|
-
|
362
|
-
## Complete Example
|
363
|
-
|
364
|
-
Here's a complete example with both ESLint and Prettier configurations:
|
365
|
-
|
366
|
-
### eslint.config.js
|
367
|
-
|
368
|
-
```js
|
369
|
-
import { eslintConfig } from "js-style-kit";
|
370
|
-
|
371
|
-
export default eslintConfig(
|
372
|
-
{
|
373
|
-
typescript: "tsconfig.eslint.json",
|
374
|
-
react: true,
|
375
|
-
jsdoc: { requireJsdoc: true },
|
376
|
-
functionStyle: "arrow",
|
377
|
-
},
|
378
|
-
{
|
379
|
-
name: "project-specific-rules",
|
380
|
-
rules: {
|
381
|
-
"no-console": ["error", { allow: ["warn", "error"] }],
|
382
|
-
},
|
383
|
-
},
|
384
|
-
);
|
385
|
-
```
|
386
|
-
|
387
|
-
### prettier.config.js
|
388
|
-
|
389
|
-
```js
|
390
|
-
import { prettierConfig } from "js-style-kit";
|
391
|
-
|
392
|
-
export default prettierConfig({
|
393
|
-
tailwindPlugin: true,
|
394
|
-
cssOrderPlugin: true,
|
395
|
-
printWidth: 100,
|
396
|
-
singleQuote: true,
|
397
|
-
});
|
398
|
-
```
|
399
|
-
|
400
|
-
## License
|
401
|
-
|
402
|
-
MIT
|