@lqbach/eslint-config 0.3.4 → 0.5.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/CHANGELOG.md +15 -0
- package/README.md +100 -0
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -2
- package/package.json +2 -2
- package/src/index.ts +7 -0
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.0](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.4.0...eslint-config-v0.5.0) (2024-08-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features 🚀
|
|
7
|
+
|
|
8
|
+
* add functionality for emotion css in react ([67ef1e5](https://github.com/lqbach/eslint-prettier-config/commit/67ef1e583370bb53fd10074f5b256fb5fdbca248))
|
|
9
|
+
|
|
10
|
+
## [0.4.0](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.3.4...eslint-config-v0.4.0) (2023-12-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features 🚀
|
|
14
|
+
|
|
15
|
+
* add ignores parameter ([bd6a304](https://github.com/lqbach/eslint-prettier-config/commit/bd6a304555afa3b8371f3e22cf78ab6936d8770c))
|
|
16
|
+
* add README to `eslint-config` package ([#11](https://github.com/lqbach/eslint-prettier-config/issues/11)) ([8bcf82d](https://github.com/lqbach/eslint-prettier-config/commit/8bcf82dd94ceeb5f42e5807b46a682586e41b937))
|
|
17
|
+
|
|
3
18
|
## [0.3.4](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.3.3...eslint-config-v0.3.4) (2023-11-28)
|
|
4
19
|
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -10,3 +10,103 @@
|
|
|
10
10
|
<img src="https://img.shields.io/github/release-date/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F" alt="release-date"/>
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
|
+
|
|
14
|
+
- [Usage](#usage)
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [pnpm](#pnpm)
|
|
17
|
+
- [yarn](#yarn)
|
|
18
|
+
- [npm](#npm)
|
|
19
|
+
- [Setup](#setup)
|
|
20
|
+
- [VSCode Support](#vscode-support)
|
|
21
|
+
- [Features](#features)
|
|
22
|
+
- [Ignoring Files](#ignoring-files)
|
|
23
|
+
- [React and Vue](#react-and-vue)
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Installation
|
|
28
|
+
|
|
29
|
+
#### pnpm
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
pnpm add -D @lqbach/eslint-config eslint
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### yarn
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
yarn add -D @lqbach/eslint-config eslint
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### npm
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
npm install -D @lqbach/eslint-config eslint
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Setup
|
|
48
|
+
|
|
49
|
+
This configuration file uses the new [flat ESLint Configuration](https://eslint.org/docs/latest/use/configure/configuration-files-new). Setting this up can be as seamless as one line of code.
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
// eslint.config.js
|
|
53
|
+
import eslintConfig from "@lqbach/eslint-config"
|
|
54
|
+
|
|
55
|
+
export default eslintConfig()
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> [!WARNING]
|
|
59
|
+
> ESLint flat configs don't really support `.eslintignore` files anymore. To ignore files, you should use the new global `ignores` that can be easily configured with this config library See [ignoring files](#ignoring-files) below.
|
|
60
|
+
|
|
61
|
+
### VSCode Support
|
|
62
|
+
|
|
63
|
+
Visual Studio Code has an [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) (or search _`dbaeumer.vscode-eslint`_ in the Extension Marketplace search bar) that supports rich editing features. This will help lint file saves and provide linting documentation in the code.
|
|
64
|
+
The following should be added to `.vscode/settings.json` at the root of your project:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
// Include the below if using Prettier
|
|
69
|
+
// "editor.formatOnSave": true,
|
|
70
|
+
|
|
71
|
+
// Tell the ESLint plugin to run on save
|
|
72
|
+
"editor.codeActionsOnSave": {
|
|
73
|
+
"source.fixAll.eslint": true
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
// To enable proper ESLint behavior with flat configurations
|
|
77
|
+
"eslint.experimental.useFlatConfig": true
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Features
|
|
82
|
+
|
|
83
|
+
### Ignoring Files
|
|
84
|
+
|
|
85
|
+
You can ignore files by using the `ignores` parameter which accepts an array of strings. Reference the [ignore patterns](https://eslint.org/docs/latest/use/configure/ignore) from the ESLint documentation for proper glob syntax.
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
// eslint.config.js
|
|
89
|
+
import eslintConfig from "@lqbach/eslint-config"
|
|
90
|
+
|
|
91
|
+
export default eslintConfig({
|
|
92
|
+
ignores: ["./sanity", "./public/*.js"],
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The above will ignore the `sanity` folder and all JavaScript files in the `public` folder.
|
|
97
|
+
|
|
98
|
+
### React and Vue
|
|
99
|
+
|
|
100
|
+
If you are writing with React or Vue, you will need to toggle them on. Both `vue` and `react` parameters default to `false` until set by the user.
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
// eslint.config.js
|
|
104
|
+
import eslintConfig from "@lqbach/eslint-config"
|
|
105
|
+
|
|
106
|
+
export default eslintConfig({
|
|
107
|
+
vue: true, // defaults to false
|
|
108
|
+
|
|
109
|
+
// uncomment below and comment above to use react
|
|
110
|
+
// react: true,
|
|
111
|
+
})
|
|
112
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -369,7 +369,11 @@ function config(params = {}) {
|
|
|
369
369
|
"**/.cache",
|
|
370
370
|
"**/.output",
|
|
371
371
|
"**/*.min.*",
|
|
372
|
-
"**/LICENSE*"
|
|
372
|
+
"**/LICENSE*",
|
|
373
|
+
"**/web/public",
|
|
374
|
+
"**/studio/build",
|
|
375
|
+
"**/studio/.sanity",
|
|
376
|
+
...params.ignores ? params.ignores : []
|
|
373
377
|
]
|
|
374
378
|
};
|
|
375
379
|
const javascriptConfig = [
|
|
@@ -438,7 +442,9 @@ function config(params = {}) {
|
|
|
438
442
|
react: import_eslint_plugin_react.default
|
|
439
443
|
},
|
|
440
444
|
rules: {
|
|
441
|
-
...import_eslint_plugin_react.default.configs.recommended.rules
|
|
445
|
+
...import_eslint_plugin_react.default.configs.recommended.rules,
|
|
446
|
+
// ignore `css` for emotion usage
|
|
447
|
+
"react/no-unknown-property": ["error", { ignore: ["css"] }]
|
|
442
448
|
}
|
|
443
449
|
} : {};
|
|
444
450
|
const vueConfig = params.vue ?? false ? {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -358,7 +358,11 @@ function config(params = {}) {
|
|
|
358
358
|
"**/.cache",
|
|
359
359
|
"**/.output",
|
|
360
360
|
"**/*.min.*",
|
|
361
|
-
"**/LICENSE*"
|
|
361
|
+
"**/LICENSE*",
|
|
362
|
+
"**/web/public",
|
|
363
|
+
"**/studio/build",
|
|
364
|
+
"**/studio/.sanity",
|
|
365
|
+
...params.ignores ? params.ignores : []
|
|
362
366
|
]
|
|
363
367
|
};
|
|
364
368
|
const javascriptConfig = [
|
|
@@ -427,7 +431,9 @@ function config(params = {}) {
|
|
|
427
431
|
react: default8
|
|
428
432
|
},
|
|
429
433
|
rules: {
|
|
430
|
-
...default8.configs.recommended.rules
|
|
434
|
+
...default8.configs.recommended.rules,
|
|
435
|
+
// ignore `css` for emotion usage
|
|
436
|
+
"react/no-unknown-property": ["error", { ignore: ["css"] }]
|
|
431
437
|
}
|
|
432
438
|
} : {};
|
|
433
439
|
const vueConfig = params.vue ?? false ? {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lqbach/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "lqbach's Personal Eslint Config",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"vue-eslint-parser": "^9.3.2",
|
|
35
35
|
"yaml-eslint-parser": "^1.2.2"
|
|
36
36
|
},
|
|
37
|
-
"
|
|
37
|
+
"peerDependencies": {
|
|
38
38
|
"eslint": "^8.53.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
package/src/index.ts
CHANGED
|
@@ -41,6 +41,11 @@ export default function config(params: ConfigParams = {}): Array<ConfigObject> {
|
|
|
41
41
|
|
|
42
42
|
"**/*.min.*",
|
|
43
43
|
"**/LICENSE*",
|
|
44
|
+
|
|
45
|
+
"**/web/public",
|
|
46
|
+
"**/studio/build",
|
|
47
|
+
"**/studio/.sanity",
|
|
48
|
+
...(params.ignores ? params.ignores : []),
|
|
44
49
|
],
|
|
45
50
|
}
|
|
46
51
|
|
|
@@ -121,6 +126,8 @@ export default function config(params: ConfigParams = {}): Array<ConfigObject> {
|
|
|
121
126
|
},
|
|
122
127
|
rules: {
|
|
123
128
|
...pluginReact.configs.recommended.rules,
|
|
129
|
+
// ignore `css` for emotion usage
|
|
130
|
+
"react/no-unknown-property": ["error", { ignore: ["css"] }],
|
|
124
131
|
},
|
|
125
132
|
}
|
|
126
133
|
: {}
|