isaacscript-lint 4.12.0 → 4.12.1

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.
Files changed (2) hide show
  1. package/README.md +49 -30
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -2,21 +2,15 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/isaacscript-lint.svg)](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 or a typical IsaacScript mod.
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
- ## For Use in a TypeScript / TypeScriptToLua Project
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
- See the [installation instructions](#installation-instructions-for-typescript-projects) below.
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/user-guide/configuring
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
- // We modify the linting rules from the base for some specific things.
95
- rules: {},
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
- ```jsonc
107
+ ```ts
106
108
  // A special TypeScript configuration file, used by ESLint only.
107
109
  {
108
110
  "extends": "./tsconfig.json",
109
111
 
110
- // A list of the TypeScript files to compile:
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
- // This must match the "include" setting in the main "tsconfig.json" file.
113
- "./src/**/*.ts",
114
-
115
- // These are ESLint-only inclusions. Usually, this includes any files that are outside of your
116
- // "src" directory, such as "webpack.config.js", "jest.config.js", "Gruntfile.js", and so forth.
117
- "./.eslintrc.cjs"
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
- ```jsonc
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
- ```jsonc
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.0",
3
+ "version": "4.12.1",
4
4
  "description": "A linting dependency meta-package for IsaacScript and TypeScript projects.",
5
5
  "keywords": [
6
6
  "isaacscript",
@@ -30,7 +30,7 @@
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.0",
33
+ "eslint-config-isaacscript": "^3.5.1",
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",