@remcohaszing/eslint 11.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.md +18 -0
- package/README.md +134 -0
- package/lib/allowedProperties.js +33 -0
- package/lib/config.js +1129 -0
- package/lib/constants.js +17 -0
- package/lib/getIgnorePatterns.js +27 -0
- package/package.json +59 -0
- package/types/allowedProperties.d.ts +5 -0
- package/types/allowedProperties.d.ts.map +1 -0
- package/types/config.d.ts +5 -0
- package/types/config.d.ts.map +1 -0
- package/types/constants.d.ts +9 -0
- package/types/constants.d.ts.map +1 -0
- package/types/getIgnorePatterns.d.ts +9 -0
- package/types/getIgnorePatterns.d.ts.map +1 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2019 Remco Haszing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the “Software”), to deal in the Software without restriction,
|
|
7
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
8
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
15
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
17
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# @remcohaszing/eslint
|
|
2
|
+
|
|
3
|
+
> A strict ESLint configuration
|
|
4
|
+
|
|
5
|
+
[](https://github.com/remcohaszing/@remcohaszing/eslint/actions)
|
|
6
|
+
[](https://codecov.io/gh/remcohaszing/@remcohaszing/eslint)
|
|
7
|
+
[](https://www.npmjs.com/package/@remcohaszing/eslint)
|
|
8
|
+
[](https://prettier.io)
|
|
9
|
+
|
|
10
|
+
This is a strict shareable ESLint configuration. All ESLint core rules and a variety of ESLint
|
|
11
|
+
plugins have been carefully considered. Overrides are used to apply rules based on context.
|
|
12
|
+
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Configuration](#configuration)
|
|
17
|
+
- [TypeScript](#typescript)
|
|
18
|
+
- [Markdown](#markdown)
|
|
19
|
+
- [Disabling rules](#disabling-rules)
|
|
20
|
+
- [Ignored files](#ignored-files)
|
|
21
|
+
- [Warnings](#warnings)
|
|
22
|
+
- [Compatibility](#compatibility)
|
|
23
|
+
- [License](#license)
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Install `@remcohaszing/eslint` using `npm`.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
npm install --save-dev \
|
|
31
|
+
eslint \
|
|
32
|
+
@remcohaszing/eslint \
|
|
33
|
+
prettier
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration
|
|
37
|
+
|
|
38
|
+
First [configure Prettier](https://prettier.io/docs/en/configuration.html). For example, create a
|
|
39
|
+
`.editorconfig` with the following content:
|
|
40
|
+
|
|
41
|
+
```ini
|
|
42
|
+
root = true
|
|
43
|
+
|
|
44
|
+
[*]
|
|
45
|
+
charset = utf-8
|
|
46
|
+
end_of_line = lf
|
|
47
|
+
indent_size = 2
|
|
48
|
+
indent_style = space
|
|
49
|
+
insert_final_newline = true
|
|
50
|
+
max_line_length = 100
|
|
51
|
+
trim_trailing_whitespace = true
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
And create a `.prettierrc.yaml` with the following content:
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
proseWrap: always
|
|
58
|
+
singleQuote: true
|
|
59
|
+
trailingComma: all
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Next, create `eslint.config.js` with the following content:
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
export { default } from '@remcohaszing/eslint'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### TypeScript
|
|
69
|
+
|
|
70
|
+
This configuration enabled ESLint for TypeScript automatically.
|
|
71
|
+
|
|
72
|
+
Some rules from `@typescript-eslint/eslint-plugin` require TypeScript type checking features to be
|
|
73
|
+
enabled. Unfortunately, this makes ESLint slow. Enabling these rules is recommended for small
|
|
74
|
+
projects only. To enable this, add the following to `eslint.config.js`:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
import config, { typechecking } from '@remcohaszing/eslint'
|
|
78
|
+
|
|
79
|
+
export default [...config, ...typechecking]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Markdown
|
|
83
|
+
|
|
84
|
+
Code blocks in Markdown are linted by default using
|
|
85
|
+
[`@eslint/markdown`](https://github.com/eslint/markdown). The type checking rules from
|
|
86
|
+
`@typescript-eslint/eslint-plugin` don’t work with markdown code blocks.
|
|
87
|
+
|
|
88
|
+
`prettier/prettier` is disabled, because it doesn’t play nice with `eslint-plugin-markdown`.
|
|
89
|
+
|
|
90
|
+
Some other rules have been turned off, because these rules may conflict with the purpose of the
|
|
91
|
+
documentation.
|
|
92
|
+
|
|
93
|
+
### Disabling rules
|
|
94
|
+
|
|
95
|
+
Rules can be disabled by adding an extra ESLint configuration item to the configuration array. For
|
|
96
|
+
example:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
import config from '@remcohaszing/eslint'
|
|
100
|
+
|
|
101
|
+
export default [
|
|
102
|
+
...config,
|
|
103
|
+
{
|
|
104
|
+
rules: {
|
|
105
|
+
'no-console': 'off'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Ignored files
|
|
112
|
+
|
|
113
|
+
By default ESLint ignores `node_modules/` and all dotfiles. This ESLint configuration also ignores
|
|
114
|
+
the patterns from `.gitignore`.
|
|
115
|
+
|
|
116
|
+
## Warnings
|
|
117
|
+
|
|
118
|
+
All ESLint that are turned on will trigger error, not warnings. The notable exceptions is
|
|
119
|
+
`@typescript-eslint/no-deprecated`.
|
|
120
|
+
|
|
121
|
+
This is to allow a smooth migration if a dependency decides to deprecate an API. To turn make
|
|
122
|
+
warnings cause ESLint to exit with exit code 1, run:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
eslint
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Compatibility
|
|
129
|
+
|
|
130
|
+
This project requires Node.js 22 or greater.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
[MIT](./LICENSE.md) © [Remco Haszing](https://github.com/remcohaszing)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These property names are allowed, because exist in commonly used specifications.
|
|
3
|
+
*/
|
|
4
|
+
export const allowedProperties = [
|
|
5
|
+
// OAuth2
|
|
6
|
+
'access_token',
|
|
7
|
+
'client_id',
|
|
8
|
+
'client_secret',
|
|
9
|
+
'error_description',
|
|
10
|
+
'error_uri',
|
|
11
|
+
'expires_in',
|
|
12
|
+
'grant_type',
|
|
13
|
+
'redirect_uri',
|
|
14
|
+
'refresh_token',
|
|
15
|
+
'response_type',
|
|
16
|
+
'token_type',
|
|
17
|
+
|
|
18
|
+
// OpenID
|
|
19
|
+
'email_verified',
|
|
20
|
+
'id_token',
|
|
21
|
+
|
|
22
|
+
// Web app manifest
|
|
23
|
+
'background_color',
|
|
24
|
+
'iarc_rating_id',
|
|
25
|
+
'short_name',
|
|
26
|
+
'prefer_related_applications',
|
|
27
|
+
'related_applications',
|
|
28
|
+
'start_url',
|
|
29
|
+
'theme_color',
|
|
30
|
+
|
|
31
|
+
// React
|
|
32
|
+
'__html'
|
|
33
|
+
]
|