@richardscull/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 richardscull
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,178 @@
1
+ # eslint-config-hyoban
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+ [![License][license-src]][license-href]
6
+
7
+ Hyoban's ESLint Config enables most of the recommended rules for `js`, `ts`, and `react`, uses ESLint for formatting, and provides a lot of useful plugins.
8
+
9
+ Read more about why I use ESLint for linting and formatting on [xLog](https://hyoban.xlog.app/why-eslint).
10
+
11
+ | Basic | Style | React | Others | Tools |
12
+ | ------------------ | ---------------- | ------------- | ------------------- | ---------------------- |
13
+ | [js] ✅ | [stylistic] ✅ | [react] ✅ | [Tailwind CSS] ✅ | [config-inspector] ✅ |
14
+ | [ts] ✅ | [antfu] ✅ | [hooks] ✅ | [UnoCSS] ✅ | [eslint-types] |
15
+ | [unicorn] ✅ | [import-sort] ✅ | [refresh] ✅ | [flat-gitignore] ✅ | [eslint-typegen] ✅ |
16
+ | [import-x] ✅ | [jsonc] ✅ | [compiler] ✅ | [command] ✅ | [@antfu/eslint-config] |
17
+ | [unused-import] ✅ | [yml] | [jsx-a11y] | [regexp] ✅ | |
18
+ | [n] | [perfectionist] | [next] | [package-json] ✅ | |
19
+ | [compat] | [format] | [jsx-nesting] | [cspell] | |
20
+
21
+ ## Usage
22
+
23
+ > [!TIP]
24
+ > You may not need `lint-staged` and `simple-git-hooks` if you don't ignore auto-fix for rules in the editor.
25
+
26
+ ```sh
27
+ ni -D eslint eslint-config-hyoban lint-staged simple-git-hooks
28
+ ```
29
+
30
+ If you are using ESLint 9.9.0 and `eslint.config.ts`, you need to install `jiti`.
31
+
32
+ ```sh
33
+ ni -D jiti
34
+ ```
35
+
36
+ > [!TIP]
37
+ > You can install the nightly version from [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new), for example, `ni -D https://pkg.pr.new/hyoban/eslint-config-hyoban@{commit}`.
38
+
39
+ `eslint.config.mjs` or `eslint.config.ts` if you are using ESLint 9.9.0.
40
+
41
+ ```ts
42
+ // @ts-check
43
+ import { defineConfig } from 'eslint-config-hyoban'
44
+
45
+ export default defineConfig()
46
+ ```
47
+
48
+ > [!TIP]
49
+ > You can customize the preset by passing options according to [available options](https://github.com/hyoban/eslint-config-hyoban/blob/main/src/option.ts)
50
+
51
+ `package.json`
52
+
53
+ ```json
54
+ {
55
+ "scripts": {
56
+ "lint": "eslint",
57
+ "lint:fix": "eslint --fix",
58
+ "prepare": "simple-git-hooks"
59
+ },
60
+ "simple-git-hooks": {
61
+ "pre-commit": "npx lint-staged"
62
+ },
63
+ "lint-staged": {
64
+ "*": "eslint --fix"
65
+ }
66
+ }
67
+ ```
68
+
69
+ Use `eslint --flag unstable_ts_config` if you are using ESLint 9.9.0 and `eslint.config.ts`.
70
+
71
+ `.vscode/settings.json` for VSCode.
72
+
73
+ ```jsonc
74
+ {
75
+ // You shouldn't use formatter with this ESLint config
76
+ "[javascript][javascriptreact][typescript][typescriptreact][json][jsonc]": {
77
+ "editor.formatOnSave": false,
78
+ "editor.codeActionsOnSave": {
79
+ "source.fixAll.eslint": "explicit"
80
+ }
81
+ },
82
+
83
+ // If you are using ESLint 9.9.0 and eslint.config.ts
84
+ "eslint.options": {
85
+ "flags": ["unstable_ts_config"]
86
+ },
87
+
88
+ // If you do not want to auto fix some rules on save
89
+ // You can put this in your user settings or workspace settings
90
+ "eslint.codeActionsOnSave.rules": [
91
+ "!prefer-const",
92
+ "!unused-imports/no-unused-imports",
93
+ "!@stylistic/jsx-self-closing-comp",
94
+ "!tailwindcss/classnames-order",
95
+ "*"
96
+ ],
97
+
98
+ // If you want to silent stylistic rules
99
+ // You can put this in your user settings or workspace settings
100
+ "eslint.rules.customizations": [
101
+ { "rule": "@stylistic/*", "severity": "off", "fixable": true },
102
+ { "rule": "antfu/consistent-list-newline", "severity": "off" },
103
+ { "rule": "hyoban/jsx-attribute-spacing", "severity": "off" },
104
+ { "rule": "simple-import-sort/*", "severity": "off" },
105
+ { "rule": "prefer-const", "severity": "off" },
106
+ { "rule": "unused-imports/no-unused-imports", "severity": "off" },
107
+ { "rule": "tailwindcss/classnames-order", "severity": "off" }
108
+ ],
109
+
110
+ // You can also silent all auto fixable rules
111
+ "eslint.rules.customizations": [
112
+ { "rule": "*", "fixable": true, "severity": "off" }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ ### TypeAware Rules
118
+
119
+ We recommend using [tsslint](https://github.com/johnsoncodehk/tsslint) for type-aware rules.
120
+
121
+ A example `tsslint.config.ts`:
122
+
123
+ ```ts
124
+ import { defineConfig } from "@tsslint/config"
125
+ import { convertRules } from "@tsslint/eslint"
126
+
127
+ export default defineConfig({
128
+ rules: await convertRules({
129
+ "react-x/no-leaked-conditional-rendering": "error",
130
+ }),
131
+ })
132
+ ```
133
+
134
+ ## Who is using?
135
+
136
+ - [Folo](https://github.com/RSSNext/Folo)
137
+ - [fisand](https://github.com/fisand)
138
+ - [Shiro](https://github.com/Innei/Shiro)
139
+ - [vite-react-tailwind-template](https://github.com/innei-template/vite-react-tailwind-template)
140
+
141
+ [npm-version-src]: https://img.shields.io/npm/v/eslint-config-hyoban?style=flat&colorA=080f12&colorB=1fa669
142
+ [npm-version-href]: https://npmjs.com/package/eslint-config-hyoban
143
+ [npm-downloads-src]: https://img.shields.io/npm/dm/eslint-config-hyoban?style=flat&colorA=080f12&colorB=1fa669
144
+ [npm-downloads-href]: https://npmjs.com/package/eslint-config-hyoban
145
+ [license-src]: https://img.shields.io/github/license/hyoban/eslint-config-hyoban.svg?style=flat&colorA=080f12&colorB=1fa669
146
+ [license-href]: https://github.com/hyoban/eslint-config-hyoban/blob/main/LICENSE
147
+ [js]: https://www.npmjs.com/package/@eslint/js
148
+ [ts]: https://typescript-eslint.io
149
+ [unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
150
+ [import-x]: https://github.com/un-ts/eslint-plugin-import-x
151
+ [n]: https://github.com/eslint-community/eslint-plugin-n
152
+ [compat]: https://github.com/amilajack/eslint-plugin-compat
153
+ [stylistic]: https://eslint.style
154
+ [antfu]: https://github.com/antfu/eslint-plugin-antfu
155
+ [import-sort]: https://github.com/lydell/eslint-plugin-simple-import-sort
156
+ [jsonc]: https://github.com/ota-meshi/eslint-plugin-jsonc
157
+ [yml]: https://github.com/ota-meshi/eslint-plugin-yml
158
+ [perfectionist]: https://github.com/azat-io/eslint-plugin-perfectionist
159
+ [react]: https://eslint-react.xyz
160
+ [hooks]: https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
161
+ [next]: https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-plugin
162
+ [refresh]: https://github.com/ArnaudBarre/eslint-plugin-react-refresh
163
+ [jsx-nesting]: https://github.com/MananTank/eslint-plugin-validate-jsx-nesting
164
+ [jsx-a11y]: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
165
+ [Tailwind CSS]: https://github.com/francoismassart/eslint-plugin-tailwindcss
166
+ [UnoCSS]: https://unocss.dev/integrations/eslint
167
+ [flat-gitignore]: https://github.com/antfu/eslint-config-flat-gitignore
168
+ [config-inspector]: https://github.com/eslint/config-inspector
169
+ [@antfu/eslint-config]: https://github.com/antfu/eslint-config
170
+ [eslint-types]: https://github.com/eslint-types
171
+ [format]: https://github.com/antfu/eslint-plugin-format
172
+ [unused-import]: https://github.com/sweepline/eslint-plugin-unused-imports
173
+ [package-json]: https://github.com/JoshuaKGoldberg/eslint-plugin-package-json
174
+ [eslint-typegen]: https://github.com/antfu/eslint-typegen
175
+ [command]: https://github.com/antfu/eslint-plugin-command
176
+ [regexp]: https://github.com/ota-meshi/eslint-plugin-regexp
177
+ [compiler]: https://github.com/facebook/react/tree/main/compiler/packages/eslint-plugin-react-compiler
178
+ [cspell]: https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin#readme