@nicksp/eslint-config 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025−PRESENT Nick Plekhanov (<https://plekhanov.me>)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # @nicksp/eslint-config
2
+
3
+ [![npm](https://img.shields.io/npm/v/@nicksp/eslint-config.svg)](https://www.npmjs.com/package/@nicksp/eslint-config) [![Node.js CI status](https://github.com/nicksp/eslint-config/workflows/CI/badge.svg)](https://github.com/nicksp/eslint-config/actions)
4
+
5
+ Shared ESLint config I use on my personal projects. Based on [antfu's config](https://github.com/antfu/eslint-config).
6
+
7
+ ## Difference
8
+
9
+ - Format with Prettier
10
+ - Only the tools I use are supported
11
+ - More stricter rules
12
+ - Simpler setup
13
+
14
+ ## Highlights
15
+
16
+ - Play well with TypeScript and Prettier
17
+ - Target tools I use personally on the majority of the projects: React, Next, Astro and Vitest
18
+ - Sort imports, `package.json`, `tsconfig.json`
19
+ - [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for better organization and composition
20
+ - Respects `.gitignore` by default
21
+ - Reasonable defaults, best practices, only one-line of config
22
+ - Requires ESLint v9.5.0+
23
+
24
+ ## Setup
25
+
26
+ ```shell
27
+ pnpm add -D eslint @nicksp/eslint-config
28
+ ```
29
+
30
+ Create `eslint.config.mjs` in your project root:
31
+
32
+ ```js
33
+ import { defineConfig } from '@nicksp/eslint-config'
34
+
35
+ export default defineConfig()
36
+ ```
37
+
38
+ Configure VS Code for auto-fix on save in `.vscode/settings.json`:
39
+
40
+ ```jsonc
41
+ {
42
+ // Use the Prettier formatter
43
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
44
+ "editor.formatOnSave": true,
45
+
46
+ // Autosave files on focus change
47
+ "files.autoSave": "onFocusChange",
48
+ // Don’t autosave files with syntax errors
49
+ "files.autoSaveWhenNoErrors": true,
50
+
51
+ // Auto fix
52
+ "editor.codeActionsOnSave": {
53
+ "source.fixAll.eslint": "explicit",
54
+ "source.organizeImports": "never"
55
+ },
56
+
57
+ // Silent the stylistic rules in your IDE, but still auto fix them
58
+ "eslint.rules.customizations": [
59
+ { "rule": "style/*", "severity": "off", "fixable": true },
60
+ { "rule": "format/*", "severity": "off", "fixable": true },
61
+ { "rule": "*-indent", "severity": "off", "fixable": true },
62
+ { "rule": "*-spacing", "severity": "off", "fixable": true },
63
+ { "rule": "*-spaces", "severity": "off", "fixable": true },
64
+ { "rule": "*-order", "severity": "off", "fixable": true },
65
+ { "rule": "*-dangle", "severity": "off", "fixable": true },
66
+ { "rule": "*-newline", "severity": "off", "fixable": true },
67
+ { "rule": "*quotes", "severity": "off", "fixable": true },
68
+ { "rule": "*semi", "severity": "off", "fixable": true }
69
+ ],
70
+
71
+ // Enable eslint for all supported languages
72
+ "eslint.validate": [
73
+ "javascript",
74
+ "javascriptreact",
75
+ "typescript",
76
+ "typescriptreact",
77
+ "html",
78
+ "markdown",
79
+ "json",
80
+ "json5",
81
+ "jsonc",
82
+ "yaml",
83
+ "toml",
84
+ "xml",
85
+ "gql",
86
+ "graphql",
87
+ "astro",
88
+ "css",
89
+ "less",
90
+ "scss",
91
+ "pcss",
92
+ "postcss"
93
+ ]
94
+ }
95
+ ```
96
+
97
+ ## Usage
98
+
99
+ ```js
100
+ // eslint.config.js
101
+ import { defineConfig } from '@nicksp/eslint-config'
102
+
103
+ export default defineConfig(
104
+ {
105
+ // Type of the project. 'lib' for libraries, the default is 'app'
106
+ type: 'lib',
107
+
108
+ // Formatting with Prettier is enabled by default, you can disable it
109
+ prettier: false,
110
+
111
+ // TypeScript is autodetected, you can also explicitly enable it
112
+ typescript: true,
113
+
114
+ // Disable jsx support
115
+ jsx: false,
116
+
117
+ // You can configure each integration individually as well
118
+ yaml: {
119
+ overrides: {
120
+ // ...
121
+ },
122
+ },
123
+
124
+ ignores: [
125
+ '**/fixtures',
126
+ // ...globs
127
+ ]
128
+ },
129
+
130
+ // You can have multiple config overrides
131
+ {
132
+ files: ['**/*.ts'],
133
+ rules: {},
134
+ },
135
+ {
136
+ rules: {},
137
+ },
138
+ )
139
+
140
+ // Advanced config
141
+ // See more at https://github.com/antfu/eslint-flat-config-utils
142
+ .prepend(
143
+ // some configs before the main config
144
+ ).removeRules('foo/bar')
145
+ ```
146
+
147
+ ### Optional configs
148
+
149
+ These are optional configs for specific use cases.
150
+
151
+ Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually.
152
+
153
+ ```js
154
+ // eslint.config.js
155
+ import { defineConfig } from '@nicksp/eslint-config'
156
+
157
+ export default defineConfig({
158
+ // Enable React support
159
+ react: true,
160
+
161
+ // Enable Next.js support
162
+ nextjs: true,
163
+
164
+ // Enable Astro support
165
+ astro: true,
166
+ })
167
+ ```
168
+
169
+ ## Other Projects You Might Like
170
+
171
+ - [nicksp/dotfiles](https://github.com/nicksp/dotfiles/) - My dotfiles and VS Code settings
172
+ - [nicksp/prettier](https://github.com/nicksp/prettier-config) - My Prettier config
173
+
174
+ ## License
175
+
176
+ [MIT](LICENSE) License &copy; 2025 [Nick Plekhanov](https://plekhanov.me)