isaacscript-lint 1.0.69 → 1.0.73

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/.cspell.json CHANGED
@@ -5,9 +5,12 @@
5
5
  "en_US"
6
6
  ],
7
7
  "words": [
8
+ "dbaeumer",
8
9
  "eqeqeq",
10
+ "esbenp",
9
11
  "gofmt",
10
12
  "gofmt's",
13
+ "Gruntfile",
11
14
  "isaacscript",
12
15
  "prettier's",
13
16
  "rossum",
@@ -15,4 +18,4 @@
15
18
  "tiamtowtdi",
16
19
  "zamiell"
17
20
  ]
18
- }
21
+ }
package/README.md CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  # isaacscript-lint
4
4
 
5
- `isaacscript-lint` 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
+ `isaacscript-lint` 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.
6
6
 
7
- Please see the [IsaacScript webpage](https://isaacscript.github.io/) for more information.
7
+ For more information about IsaacScript, see the [webpage](https://isaacscript.github.io/).
8
8
 
9
9
  <br />
10
10
 
11
- ## For Use With an Isaacscript Mod
11
+ ## For Use in a TypeScript / TypeScriptToLua Project
12
12
 
13
- Use the `isaacscript init` tool to automatically set up a new mod that has `isaacscript-lint` as a dependency and a starting `eslintrc.js` config file.
13
+ `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`.
14
14
 
15
- <br />
15
+ See the [installation instructions](#installation-instructions-for-typescript-projects) below.
16
16
 
17
- ## For Use in a TypeScript / TypeScriptToLua Project
17
+ <br />
18
18
 
19
- `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 depedencies; just use `isaacscript-lint`.
19
+ ## For Use With an Isaacscript Mod
20
20
 
21
- See the [installation instructions](#installation-instructions-for-typescript-projects) below.
21
+ Use the `isaacscript init` tool to automatically set up a new mod that has `isaacscript-lint` as a dependency and a starting `eslintrc.js` config file.
22
22
 
23
23
  <br />
24
24
 
@@ -30,9 +30,9 @@ One of the key insights of [Guido van Rossum](https://en.wikipedia.org/wiki/Guid
30
30
 
31
31
  [Go](https://golang.org/), the programming language designed at Google in 2009, took this concept a step further. They included a code formatter inside of the language itself, called `gofmt` (which is short for "Go formatter"). When you are coding a Go program, it will automatically format all of the code as soon as you save the file. This can be surprising and disturbing for newcomers: "Why does gofmt make my code ugly?!"
32
32
 
33
- However, once people get used to the formatter, they realize that it saves them a *tremendous amount of time*. By ignoring all formatting and typing out code "raw", and then summoning the formatter to instantly fix everything, you can quite literally code twice as fast. Rob Pike, one of the creators of Go, famously said that "gofmt's style is no one's favorite, yet gofmt is everyone's favorite". ([This YouTube clip](https://www.youtube.com/watch?v=PAAkCSZUG1c&t=523s) of Rob is a much-watch!)
33
+ However, once people get used to the formatter, they realize that it saves them a *tremendous amount of time*. By ignoring all formatting and typing out code "raw", and then summoning the formatter to instantly fix everything, you can quite literally code twice as fast. Rob Pike, one of the creators of Go, famously said that "gofmt's style is no one's favorite, yet gofmt is everyone's favorite". ([This YouTube clip](https://www.youtube.com/embed/PAAkCSZUG1c?start=523&end=568) of Rob is a much-watch!)
34
34
 
35
- `gofmt` is nice because it saves people from mundane code formatting. But there is also a benefit that is entirely separate and not readily apparent. When looking at other people's Go code on StackOverflow or GitHub, you realize that it looks exactly like your code. It's easy to read and comprehend. And you can copy-paste code snippets from other programs into your own applications without having to change anything! For programmers, this is not the norm, and it feels incredible - it's the hidden superpower of Go.
35
+ `gofmt` is nice because it saves people from mundane code formatting. But there is also a benefit that is entirely separate and not readily apparent. When looking at other people's Go code on StackOverflow or GitHub, you realize that it looks exactly like your code. It's easy to read and comprehend. And you can copy-paste code snippets from other programs into your own applications without having to change anything! For programmers, this is not the norm, and it feels great - it's the hidden superpower of Go.
36
36
 
37
37
  When Rob says that everyone loves `gofmt`, he isn't lying. Programmers across the world have taken this concept and ran with it. People now use [rustfmt](https://github.com/rust-lang/rustfmt) in [Rust](https://www.rust-lang.org/), [Black](https://github.com/psf/black) in [Python](https://www.python.org/), and [Prettier](https://prettier.io/) in [JavaScript](https://www.javascript.com/) & [TypeScript](https://www.typescriptlang.org/).
38
38
 
@@ -48,11 +48,15 @@ Historically, the the most popular style guide is the world is the [Airbnb JavaS
48
48
 
49
49
  ESLint is the industry standard tool for linting in JavaScript and TypeScript. Airbnb helpfully provides an ESLint configuration with most of their style recommendations. ESLint can function in a way similar to `gofmt` by configuring your text editor to do `eslint --fix` on save. However, this has a lot of limitations. It can't automatically fix everything and leaves a lot up to the end user to fix.
50
50
 
51
- [Prettier](https://prettier.io/) was released in 2017 and it has quickly become very widespread. (It could *probably* also be considered to be industry standard in 2021.) Prettier works by completely rebuilding your code from scratch using the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree), which allows it to make much better transformations than pure ESLint can.
51
+ [Prettier](https://prettier.io/) was released in 2017 and it has quickly become very widespread. (It could *probably* also be considered to be industry standard in 2022.) Prettier works by completely rebuilding your code from scratch using the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree), which allows it to make much better transformations than pure ESLint can.
52
+
53
+ Because of the advantages of Prettier, we use it on top of the Airbnb config, and prefer Prettier's changes if there are any conflicts. Any ESLint rules that conflict with Prettier are turned off with [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier).
52
54
 
53
- Because of the advantages of Prettier, we use it on top of the Airbnb config, and prefer Prettier's changes if there are any conflicts. Instead of running two different tools, we run Prettier inside of ESLint as a plugin with [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier). Then, any ESLint rules that conflict with Prettier are turned off with [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier).
55
+ Finally, some specific Airbnb rules are disabled, since they don't make much sense in certain contexts. You can see the specific exclusions in the [base.js](https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/base.js) and [mod.js](https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/mod.js) files of the [`eslint-config-isaacscript`](https://github.com/IsaacScript/eslint-config-isaacscript) repository.
54
56
 
55
- Finally, some specific Airbnb rules are disabled, since they don't make much sense in IsaacScript projects. You can see the specific exclusions in the [base.js](https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/base.js) and [mod.js](https://github.com/IsaacScript/eslint-config-isaacscript/blob/main/mod.js) files of the [`eslint-config-isaacscript`](https://github.com/IsaacScript/eslint-config-isaacscript) repository.
57
+ In order to avoid running two different tools, we could use [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) to run Prettier as an ESLint rule. However, doing this [is not recommended by Prettier](https://prettier.io/docs/en/integrating-with-linters.html). Thus, in order to use `isaacscript-lint`, you should be running both Prettier and ESLint on save. You can accomplish this by
58
+
59
+ In conclusion, in order to really auto-format Unfortunately, this means thatInstead of running two different tools, we run Prettier inside of ESLint as a plugin with [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier). Then,
56
60
 
57
61
  <br />
58
62
 
@@ -136,31 +140,82 @@ Create a `tsconfig.eslint.json` file in the root of your repository:
136
140
  "./src/**/*.ts",
137
141
 
138
142
  // These are ESLint-only inclusions
143
+ // Usually, this includes any files that are outside of your "src" directory,
144
+ // such as "webpack.config.js", "jest.config.js", "Gruntfile.js", and so forth
139
145
  "./.eslintrc.js",
140
146
  ],
141
147
  }
142
148
  ```
143
149
 
144
- ### Done!
150
+ ## Adding or Removing Rules
145
151
 
146
- You can add extra rules (or ignore existing rules) by editing the `rules` section of the `eslintrc.js` file. For example:
152
+ You can add extra rules (or ignore existing rules) by editing the `rules` section of your `eslintrc.js` file. For example:
147
153
 
148
154
  ```js
149
155
  // We modify the linting rules from the base for some specific things
150
156
  rules: {
151
- // Documentation:
152
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md
153
- // Not defined in parent configs
154
- // This helps to find dead code that should be deleted
155
- "import/no-unused-modules": [
156
- "error",
157
- {
158
- missingExports: true,
159
- unusedExports: true,
160
- ignoreExports: [".eslintrc.js", "src/main.ts"],
161
- },
157
+ "@typescript-eslint/no-unused-vars": "off",
158
+ },
159
+ ```
160
+
161
+ <br />
162
+
163
+ ## Integration with VSCode
164
+
165
+ [Visual Studio Code](https://code.visualstudio.com/), or VSCode for short, is the most popular TypeScript editor / IDE.
166
+
167
+ <br />
168
+
169
+ ### Extensions
170
+
171
+ In order for the linter inside of VSCode, you will have to install the following extensions:
172
+
173
+ - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
174
+ - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
175
+
176
+ ### `.vscode/settings.json`
177
+
178
+ 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:
179
+
180
+ ```jsonc
181
+ // These are Visual Studio Code settings that should apply to this particular repository
182
+ {
183
+ "[javascript]": {
184
+ "editor.codeActionsOnSave": [
185
+ "editor.formatOnSave": true,
186
+ "source.fixAll.eslint",
187
+ ],
188
+ },
189
+
190
+ "[typescript]": {
191
+ "editor.codeActionsOnSave": [
192
+ "editor.formatOnSave": true,
193
+ "source.fixAll.eslint",
162
194
  ],
163
195
  },
196
+ }
197
+ ```
198
+
199
+ (Create this file if it does not already exist.)
200
+
201
+ You can also commit this file to your project's repository so that this behavior is automatically inherited by anyone who clones the project.
202
+
203
+ ### `.vscode/extensions.json`
204
+
205
+ Optionally, you can also provide a hint to anyone cloning your repository that they should install the two required extensions:
206
+
207
+ ```jsonc
208
+ // These are Visual Studio Code extensions that are intended to be used with this particular
209
+ // repository
210
+ // https://go.microsoft.com/fwlink/?LinkId=827846
211
+ {
212
+ "recommendations": [
213
+ "esbenp.prettier-vscode", // The TypeScript formatter
214
+ "dbaeumer.vscode-eslint", // The TypeScript linter
215
+ "streetsidesoftware.code-spell-checker", // A spell-checker extension based on cspell
216
+ "typescript-to-lua.vscode-typescript-to-lua", // The TypeScriptToLua extension
217
+ ]
218
+ }
164
219
  ```
165
220
 
166
221
  <br />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-lint",
3
- "version": "1.0.69",
3
+ "version": "1.0.73",
4
4
  "description": "An updatable linting dependency container for IsaacScript projects.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,29 +9,28 @@
9
9
  "license": "GPL-3.0",
10
10
  "author": "Zamiell",
11
11
  "dependencies": {
12
- "@typescript-eslint/eslint-plugin": "^5.5.0",
13
- "@typescript-eslint/parser": "^5.5.0",
14
- "cspell": "^5.13.1",
15
- "eslint": "^8.3.0",
12
+ "@typescript-eslint/eslint-plugin": "^5.6.0",
13
+ "@typescript-eslint/parser": "^5.6.0",
14
+ "cspell": "^5.13.2",
15
+ "eslint": "^8.4.1",
16
16
  "eslint-config-airbnb-base": "^15.0.0",
17
- "eslint-config-airbnb-typescript": "^16.0.0",
18
- "eslint-config-isaacscript": "^1.0.52",
17
+ "eslint-config-airbnb-typescript": "^16.1.0",
18
+ "eslint-config-isaacscript": "^1.0.54",
19
19
  "eslint-config-prettier": "^8.3.0",
20
20
  "eslint-plugin-eqeqeq-fix": "^1.0.3",
21
21
  "eslint-plugin-eslint-comments": "^3.2.0",
22
22
  "eslint-plugin-import": "^2.25.3",
23
- "eslint-plugin-jsdoc": "^37.0.3",
23
+ "eslint-plugin-jsdoc": "^37.1.0",
24
24
  "eslint-plugin-no-implicit-map-set-loops": "^1.0.3",
25
25
  "eslint-plugin-no-template-curly-in-string-fix": "^1.0.4",
26
26
  "eslint-plugin-no-void-return-type": "^1.0.2",
27
27
  "eslint-plugin-only-warn": "^1.0.3",
28
- "eslint-plugin-prettier": "^4.0.0",
29
28
  "isaacscript-tsconfig": "^1.1.6",
30
- "prettier": "^2.5.0",
29
+ "prettier": "^2.5.1",
31
30
  "prettier-plugin-organize-imports": "^2.3.4",
32
31
  "ts-prune": "^0.10.2"
33
32
  },
34
33
  "peerDependencies": {
35
- "typescript": "4.5.2"
34
+ "typescript": "4.4.4"
36
35
  }
37
36
  }
package/update.sh CHANGED
@@ -10,7 +10,7 @@ cd "$DIR"
10
10
 
11
11
  PACKAGE_JSON="$DIR/package.json"
12
12
  OLD_HASH=$(md5sum "$PACKAGE_JSON")
13
- npx npm-check-updates --upgrade --packageFile "$PACKAGE_JSON"
13
+ npx npm-check-updates --upgrade --packageFile "$PACKAGE_JSON" --reject typescript
14
14
  NEW_HASH=$(md5sum "$PACKAGE_JSON")
15
15
  if [[ $OLD_HASH != $NEW_HASH ]]; then
16
16
  npm install