isaacscript-lint 1.0.72 → 1.0.76

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/.gitattributes CHANGED
@@ -1,2 +1,9 @@
1
1
  # Prevent Windows systems from cloning this repository with "\r\n" line endings
2
2
  core.autocrlf=false
3
+
4
+ # Prevent people from making merge commits
5
+ # https://www.endoflineblog.com/gitflow-considered-harmful
6
+ pull.rebase=true
7
+
8
+ # Convert all files to use "\n" line endings
9
+ * text=auto eol=lf
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,37 +48,13 @@ 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.
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. 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).
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.
54
52
 
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.
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).
56
54
 
57
- <br />
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.
58
56
 
59
- ## Package Documentation
60
-
61
- - [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) - Required as a peer dependency for `eslint-config-airbnb-typescript`.
62
- - [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) - Required as a peer dependency for `eslint-config-airbnb-typescript`.
63
- - [`cspell`](https://github.com/streetsidesoftware/cspell) - A spell checker for code that is intended to be paired with the [Code Spell Checker VSCode extension](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker).
64
- - [`eslint`](https://github.com/eslint/eslint) - The main linter engine for JavaScript/TypeScript, as explained above.
65
- - [`eslint-config-airbnb-base`](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) - ESLint rules that conform to the Airbnb style guide.
66
- - [`eslint-config-airbnb-typescript`](https://github.com/iamturns/eslint-config-airbnb-typescript) - Enhances the Airbnb rules with TypeScript support.
67
- - [`eslint-config-isaacscript`](https://github.com/IsaacScript/eslint-config-isaacscript) - Contains the master ESLint configuration.
68
- - [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) - Turns off all rules that conflict with Prettier.
69
- - [`eslint-plugin-eqeqeq-fix`](https://github.com/Zamiell/eslint-plugin-eqeqeq-fix) - A plugin that provides a better [`eqeqeq`](https://eslint.org/docs/rules/eqeqeq) rule.
70
- - [`eslint-plugin-eslint-comments`](https://github.com/mysticatea/eslint-plugin-eslint-comments) - A plugin that provides rules relating to ESLint comments.
71
- - [`eslint-plugin-import`](https://github.com/benmosher/eslint-plugin-import) - Required as a peer dependency for `eslint-config-airbnb-base`.
72
- - [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc) - A plugin that provides rules for [JSDoc](https://en.wikipedia.org/wiki/JSDoc).
73
- - [`eslint-plugin-no-implicit-map-set-loops`](https://github.com/Zamiell/eslint-plugin-no-implicit-map-set-loops) - A plugin that prevents unsafe iteration.
74
- - [`eslint-plugin-no-template-curly-in-string-fix`](https://github.com/Zamiell/eslint-plugin-no-template-curly-in-string-fix) - A plugin that provides a better [`no-template-curly-in-string`](https://eslint.org/docs/rules/no-template-curly-in-string) rule.
75
- - [`eslint-plugin-no-void-return-type`](https://github.com/Zamiell/eslint-plugin-no-void-return-type) - A plugin that disallows void return types on unexported functions.
76
- - [`eslint-plugin-only-warn`](https://github.com/bfanger/eslint-plugin-only-warn) - A plugin that turns all errors to warnings.
77
- - [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) - A plugin that runs Prettier as an ESLint rule.
78
- - [`isaacscript-tsconfig`](https://github.com/IsaacScript/isaacscript-tsconfig) - A package that provides a shared TypeScript configuration file. This is included in the linting meta-package for convenience.
79
- - [`prettier`](https://github.com/prettier/prettier) - This is a peer dependency for `eslint-plugin-prettier`.
80
- - [`prettier-plugin-organize-imports`](https://github.com/simonhaenisch/prettier-plugin-organize-imports) - A plugin used because Prettier will not organize imports automatically. (It has no configuration and is automatically applied to Prettier if it is installed.)
81
- - [`ts-prune`](https://github.com/nadeesha/ts-prune) - A tool to look for unused exports, which catchs bugs that the `import/no-unused-modules` rule cannot find.
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. (More info on that is below.)
82
58
 
83
59
  <br />
84
60
 
@@ -136,31 +112,110 @@ Create a `tsconfig.eslint.json` file in the root of your repository:
136
112
  "./src/**/*.ts",
137
113
 
138
114
  // These are ESLint-only inclusions
115
+ // Usually, this includes any files that are outside of your "src" directory,
116
+ // such as "webpack.config.js", "jest.config.js", "Gruntfile.js", and so forth
139
117
  "./.eslintrc.js",
140
118
  ],
141
119
  }
142
120
  ```
143
121
 
144
- ### Done!
122
+ <br />
145
123
 
146
- You can add extra rules (or ignore existing rules) by editing the `rules` section of the `eslintrc.js` file. For example:
124
+ ## Adding or Removing Rules
125
+
126
+ You can add extra rules (or ignore existing rules) by editing the `rules` section of your `eslintrc.js` file. For example:
147
127
 
148
128
  ```js
149
129
  // We modify the linting rules from the base for some specific things
150
130
  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
- },
131
+ "@typescript-eslint/no-unused-vars": "off",
132
+ },
133
+ ```
134
+
135
+ <br />
136
+
137
+ ## Integration with VSCode
138
+
139
+ [Visual Studio Code](https://code.visualstudio.com/), or VSCode for short, is the most popular TypeScript editor / IDE.
140
+
141
+ <br />
142
+
143
+ ### Extensions
144
+
145
+ In order for the linter inside of VSCode, you will have to install the following extensions:
146
+
147
+ - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
148
+ - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
149
+
150
+ ### `.vscode/settings.json`
151
+
152
+ 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
+
154
+ ```jsonc
155
+ // These are Visual Studio Code settings that should apply to this particular repository
156
+ {
157
+ "[javascript]": {
158
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
159
+ "editor.formatOnSave": true,
160
+ "editor.codeActionsOnSave": [
161
+ "source.fixAll.eslint",
162
162
  ],
163
163
  },
164
+
165
+ "[typescript]": {
166
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
167
+ "editor.formatOnSave": true,
168
+ "editor.codeActionsOnSave": [
169
+ "source.fixAll.eslint",
170
+ ],
171
+ },
172
+ }
164
173
  ```
165
174
 
175
+ (Create this file if it does not already exist.)
176
+
177
+ You can also commit this file to your project's repository so that this behavior is automatically inherited by anyone who clones the project (and uses VSCode).
178
+
179
+ ### `.vscode/extensions.json`
180
+
181
+ Optionally, you can also provide a hint to anyone cloning your repository that they should install the required extensions:
182
+
183
+ ```jsonc
184
+ // These are Visual Studio Code extensions that are intended to be used with this particular
185
+ // repository
186
+ // https://go.microsoft.com/fwlink/?LinkId=827846
187
+ {
188
+ "recommendations": [
189
+ "esbenp.prettier-vscode", // The TypeScript formatter
190
+ "dbaeumer.vscode-eslint", // The TypeScript linter
191
+ "streetsidesoftware.code-spell-checker", // A spell-checker extension based on cspell
192
+ ],
193
+ }
194
+ ```
195
+
196
+ <br />
197
+
198
+ ## Package Documentation
199
+
200
+ - [`@typescript-eslint/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) - Required as a peer dependency for `eslint-config-airbnb-typescript`.
201
+ - [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) - Required as a peer dependency for `eslint-config-airbnb-typescript`.
202
+ - [`cspell`](https://github.com/streetsidesoftware/cspell) - A spell checker for code that is intended to be paired with the [Code Spell Checker VSCode extension](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker).
203
+ - [`eslint`](https://github.com/eslint/eslint) - The main linter engine for JavaScript/TypeScript, as explained above.
204
+ - [`eslint-config-airbnb-base`](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) - ESLint rules that conform to the Airbnb style guide.
205
+ - [`eslint-config-airbnb-typescript`](https://github.com/iamturns/eslint-config-airbnb-typescript) - Enhances the Airbnb rules with TypeScript support.
206
+ - [`eslint-config-isaacscript`](https://github.com/IsaacScript/eslint-config-isaacscript) - Contains the master ESLint configuration.
207
+ - [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) - Turns off all rules that conflict with Prettier.
208
+ - [`eslint-plugin-eqeqeq-fix`](https://github.com/Zamiell/eslint-plugin-eqeqeq-fix) - A plugin that provides a better [`eqeqeq`](https://eslint.org/docs/rules/eqeqeq) rule.
209
+ - [`eslint-plugin-eslint-comments`](https://github.com/mysticatea/eslint-plugin-eslint-comments) - A plugin that provides rules relating to ESLint comments.
210
+ - [`eslint-plugin-import`](https://github.com/benmosher/eslint-plugin-import) - Required as a peer dependency for `eslint-config-airbnb-base`.
211
+ - [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc) - A plugin that provides rules for [JSDoc](https://en.wikipedia.org/wiki/JSDoc).
212
+ - [`eslint-plugin-no-implicit-map-set-loops`](https://github.com/Zamiell/eslint-plugin-no-implicit-map-set-loops) - A plugin that prevents unsafe iteration.
213
+ - [`eslint-plugin-no-template-curly-in-string-fix`](https://github.com/Zamiell/eslint-plugin-no-template-curly-in-string-fix) - A plugin that provides a better [`no-template-curly-in-string`](https://eslint.org/docs/rules/no-template-curly-in-string) rule.
214
+ - [`eslint-plugin-no-void-return-type`](https://github.com/Zamiell/eslint-plugin-no-void-return-type) - A plugin that disallows void return types on unexported functions.
215
+ - [`eslint-plugin-only-warn`](https://github.com/bfanger/eslint-plugin-only-warn) - A plugin that turns all errors to warnings.
216
+ - [`isaacscript-tsconfig`](https://github.com/IsaacScript/isaacscript-tsconfig) - A package that provides a shared TypeScript configuration file. This is included in the linting meta-package for convenience.
217
+ - [`prettier`](https://github.com/prettier/prettier) - This is a peer dependency for `eslint-plugin-prettier`.
218
+ - [`prettier-plugin-organize-imports`](https://github.com/simonhaenisch/prettier-plugin-organize-imports) - A plugin used because Prettier will not organize imports automatically. (It has no configuration and is automatically applied to Prettier if it is installed.)
219
+ - [`ts-prune`](https://github.com/nadeesha/ts-prune) - A tool to look for unused exports, which catchs bugs that the `import/no-unused-modules` rule cannot find.
220
+
166
221
  <br />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-lint",
3
- "version": "1.0.72",
3
+ "version": "1.0.76",
4
4
  "description": "An updatable linting dependency container for IsaacScript projects.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,27 +9,26 @@
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.8.0",
13
+ "@typescript-eslint/parser": "^5.8.0",
14
+ "cspell": "^5.13.4",
15
+ "eslint": "^8.5.0",
16
16
  "eslint-config-airbnb-base": "^15.0.0",
17
17
  "eslint-config-airbnb-typescript": "^16.1.0",
18
- "eslint-config-isaacscript": "^1.0.53",
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.1.0",
23
+ "eslint-plugin-jsdoc": "^37.4.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
- "isaacscript-tsconfig": "^1.1.6",
30
- "prettier": "^2.5.0",
28
+ "isaacscript-tsconfig": "^1.1.8",
29
+ "prettier": "^2.5.1",
31
30
  "prettier-plugin-organize-imports": "^2.3.4",
32
- "ts-prune": "^0.10.2"
31
+ "ts-prune": "^0.10.3"
33
32
  },
34
33
  "peerDependencies": {
35
34
  "typescript": "4.4.4"
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" --reject typescript
13
+ npx npm-check-updates --upgrade --packageFile "$PACKAGE_JSON"
14
14
  NEW_HASH=$(md5sum "$PACKAGE_JSON")
15
15
  if [[ $OLD_HASH != $NEW_HASH ]]; then
16
16
  npm install