isaacscript-lint 4.12.0 → 4.12.2
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 +49 -30
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,21 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/isaacscript-lint)
|
|
4
4
|
|
|
5
|
-
This is a helper package to install all of the dependencies necessary for ESLint to work with a typical TypeScript project
|
|
5
|
+
This is a helper/meta package to install all of the dependencies necessary for [Prettier](https://prettier.io/) + [ESLint](https://eslint.org/) to work with a typical TypeScript project.
|
|
6
6
|
|
|
7
7
|
<br>
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Why This Package Is Useful
|
|
10
10
|
|
|
11
11
|
`isaacscript-lint` is a great starting point for any TypeScript project. It's a pain in the ass to get ESLint working with TypeScript and to get everything working properly. Don't clutter your `package.json` file with 15+ different ESLint-related dependencies; just use `isaacscript-lint`.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<br>
|
|
16
|
-
|
|
17
|
-
## For Use in an Isaacscript Mod
|
|
18
|
-
|
|
19
|
-
Use the `isaacscript init` tool to automatically set up a new mod that has `isaacscript-lint` as a dependency and a starting `eslintrc.cjs` config file.
|
|
13
|
+
If you are ready to start, see the [installation instructions](#installation-instructions-for-typescript-projects) below.
|
|
20
14
|
|
|
21
15
|
<br>
|
|
22
16
|
|
|
@@ -65,7 +59,14 @@ It should have a `package.json` file, a `tsconfig.json` file, and so on.
|
|
|
65
59
|
### Step 1 - Install the Dependency
|
|
66
60
|
|
|
67
61
|
```sh
|
|
62
|
+
# If you use npm:
|
|
68
63
|
npm install isaacscript-lint --save-dev
|
|
64
|
+
|
|
65
|
+
# If you use yarn:
|
|
66
|
+
yarn install isaacscript-lint --dev
|
|
67
|
+
|
|
68
|
+
# If you use pnpm:
|
|
69
|
+
pnpm install isaacscript-lint --save-dev
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
(It should be a development dependency because it is only used to lint your code pre-production.)
|
|
@@ -76,7 +77,7 @@ Create a `eslintrc.cjs` file in the root of your repository:
|
|
|
76
77
|
|
|
77
78
|
```js
|
|
78
79
|
// This is the configuration file for ESLint, the TypeScript linter:
|
|
79
|
-
// https://eslint.org/docs/latest/
|
|
80
|
+
// https://eslint.org/docs/latest/use/configure/
|
|
80
81
|
module.exports = {
|
|
81
82
|
extends: [
|
|
82
83
|
// The linter base is the shared IsaacScript config:
|
|
@@ -91,8 +92,9 @@ module.exports = {
|
|
|
91
92
|
project: "./tsconfig.eslint.json",
|
|
92
93
|
},
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
rules: {
|
|
96
|
+
// Insert changed or disabled rules here, if necessary.
|
|
97
|
+
},
|
|
96
98
|
};
|
|
97
99
|
```
|
|
98
100
|
|
|
@@ -102,31 +104,48 @@ Create a `tsconfig.eslint.json` file in the root of your repository:
|
|
|
102
104
|
|
|
103
105
|
<!-- cspell:ignore Gruntfile -->
|
|
104
106
|
|
|
105
|
-
```
|
|
107
|
+
```ts
|
|
106
108
|
// A special TypeScript configuration file, used by ESLint only.
|
|
107
109
|
{
|
|
108
110
|
"extends": "./tsconfig.json",
|
|
109
111
|
|
|
110
|
-
//
|
|
112
|
+
// We want to lint every file in the repository, regardless of whether it is actually bundled into
|
|
113
|
+
// the TypeScript output or not. Two entries for each file extension are needed because TypeScript
|
|
114
|
+
// will exclude files that begin with a period from an asterisk glob by default.
|
|
111
115
|
"include": [
|
|
112
|
-
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
|
|
116
|
+
"./**/*.js",
|
|
117
|
+
"./**/.*.js",
|
|
118
|
+
"./**/*.cjs",
|
|
119
|
+
"./**/.*.cjs",
|
|
120
|
+
"./**/*.mjs",
|
|
121
|
+
"./**/.*.mjs",
|
|
122
|
+
"./**/*.jsx",
|
|
123
|
+
"./**/.*.jsx",
|
|
124
|
+
"./**/*.ts",
|
|
125
|
+
"./**/.*.ts",
|
|
126
|
+
"./**/*.cts",
|
|
127
|
+
"./**/.*.cts",
|
|
128
|
+
"./**/*.mts",
|
|
129
|
+
"./**/.*.mts",
|
|
130
|
+
"./**/*.tsx",
|
|
131
|
+
"./**/.*.tsx"
|
|
132
|
+
],
|
|
119
133
|
}
|
|
120
134
|
```
|
|
121
135
|
|
|
136
|
+
### Step 4 - Enabling Auto-Fix on Save
|
|
137
|
+
|
|
138
|
+
- You will probably want to set up your code editor such that both Prettier and ESLint are automatically run every time the file is saved.
|
|
139
|
+
- If you see VSCode, see [the VSCode section below](#integration-with-vscode).
|
|
140
|
+
- It's also possible to set this up in other editors such as [Webstorm](https://www.jetbrains.com/webstorm/) and [Neovim](https://neovim.io/), but we don't provide detailed instructions for that here.
|
|
141
|
+
|
|
122
142
|
<br>
|
|
123
143
|
|
|
124
144
|
## Adding or Removing Rules
|
|
125
145
|
|
|
126
|
-
You can add extra rules (or ignore existing rules) by editing the `rules` section of your `eslintrc.cjs` file. For example:
|
|
146
|
+
You can add extra ESLint rules (or ignore existing ESLint rules) by editing the `rules` section of your `eslintrc.cjs` file. For example:
|
|
127
147
|
|
|
128
148
|
```js
|
|
129
|
-
// We modify the linting rules from the base for some specific things.
|
|
130
149
|
rules: {
|
|
131
150
|
"@typescript-eslint/no-unused-vars": "off",
|
|
132
151
|
},
|
|
@@ -151,22 +170,22 @@ In order for the linter to work inside of VSCode, you will have to install the f
|
|
|
151
170
|
|
|
152
171
|
Furthermore, you will probably want Prettier and ESLint to be run automatically every time you save a TypeScript file. You can tell VSCode to do this by adding the following to your project's `.vscode/settings.json` file:
|
|
153
172
|
|
|
154
|
-
```
|
|
173
|
+
```ts
|
|
155
174
|
// These are Visual Studio Code settings that should apply to this particular repository.
|
|
156
175
|
{
|
|
157
176
|
"[javascript]": {
|
|
158
177
|
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
|
|
159
178
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
160
179
|
"editor.formatOnSave": true,
|
|
161
|
-
"editor.tabSize": 2
|
|
180
|
+
"editor.tabSize": 2,
|
|
162
181
|
},
|
|
163
182
|
|
|
164
183
|
"[typescript]": {
|
|
165
184
|
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
|
|
166
185
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
167
186
|
"editor.formatOnSave": true,
|
|
168
|
-
"editor.tabSize": 2
|
|
169
|
-
}
|
|
187
|
+
"editor.tabSize": 2,
|
|
188
|
+
},
|
|
170
189
|
}
|
|
171
190
|
```
|
|
172
191
|
|
|
@@ -178,15 +197,15 @@ You can also commit this file to your project's repository so that this behavior
|
|
|
178
197
|
|
|
179
198
|
Optionally, you can also provide a hint to anyone cloning your repository that they should install the required extensions:
|
|
180
199
|
|
|
181
|
-
```
|
|
200
|
+
```ts
|
|
182
201
|
// These are Visual Studio Code extensions that are intended to be used with this particular
|
|
183
202
|
// repository: https://go.microsoft.com/fwlink/?LinkId=827846
|
|
184
203
|
{
|
|
185
204
|
"recommendations": [
|
|
186
205
|
"esbenp.prettier-vscode", // The TypeScript formatter
|
|
187
206
|
"dbaeumer.vscode-eslint", // The TypeScript linter
|
|
188
|
-
"streetsidesoftware.code-spell-checker" // A spell-checker extension based on CSpell
|
|
189
|
-
]
|
|
207
|
+
"streetsidesoftware.code-spell-checker", // A spell-checker extension based on CSpell
|
|
208
|
+
],
|
|
190
209
|
}
|
|
191
210
|
```
|
|
192
211
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-lint",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.2",
|
|
4
4
|
"description": "A linting dependency meta-package for IsaacScript and TypeScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaacscript",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@prettier/plugin-xml": "^2.2.0",
|
|
25
25
|
"@tsconfig/recommended": "^1.0.2",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
27
|
-
"@typescript-eslint/parser": "^5.
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
27
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
28
28
|
"cspell": "^6.26.3",
|
|
29
29
|
"cspell-check-unused-words": "^1.0.4",
|
|
30
30
|
"eslint": "^8.34.0",
|
|
31
31
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
32
32
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
33
|
-
"eslint-config-isaacscript": "^3.5.
|
|
33
|
+
"eslint-config-isaacscript": "^3.5.2",
|
|
34
34
|
"eslint-config-prettier": "^8.6.0",
|
|
35
35
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
36
36
|
"eslint-plugin-import": "^2.27.5",
|