isaacscript-lint 4.16.9 → 4.16.11

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 +24 -15
  2. package/package.json +18 -21
package/README.md CHANGED
@@ -2,13 +2,13 @@
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/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.
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. (Prettier is the best code formatter and ESLint is the best code problem checker.)
6
6
 
7
7
  <br>
8
8
 
9
9
  ## Why This Package Is Useful
10
10
 
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`.
11
+ It's a pain to get Prettier & ESLint working with TypeScript. So, `isaacscript-lint` is designed to make it as easy as possible. Don't clutter your `package.json` file with 15+ different ESLint-related dependencies; just use `isaacscript-lint`.
12
12
 
13
13
  If you are ready to start, see the [installation instructions](#installation-instructions-for-typescript-projects) below.
14
14
 
@@ -32,19 +32,27 @@ The root of the problem here is that when people try out a new programming langu
32
32
 
33
33
  <br>
34
34
 
35
- ## TypeScript Code Formatting - ESLint & Prettier
35
+ ## Why We Use Prettier & ESLint
36
36
 
37
- In JavaScript and TypeScript land, there isn't a unifying standard like there is in Go, but we can get close.
37
+ ### Prettier
38
38
 
39
- Historically, the most popular style guide is the world is the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript). ([Google's Style Guide](https://google.github.io/styleguide/jsguide.html) and [StandardJS](https://standardjs.com/) are also notable, but don't seem quite as popular.) Thus, we chose Airbnb as a base for new JavaScript and TypeScript projects.
39
+ In JavaScript and TypeScript land, there isn't an official code formatting standard like there is in Go, but we can get close.
40
40
 
41
- 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.
41
+ [Prettier](https://prettier.io/) is an auto-formatter for JavaScript/TypeScript. First released in 2017, it has become widespread and is probably considered to be the industry standard in 2023. 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 better transformations than other tools.
42
42
 
43
- [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.
43
+ In `isaacscript-lint`, we choose we choose the Prettier style for code formatting, since it is the most popular TypeScript style. Any ESLint rules that conflict with Prettier are turned off with [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier).
44
44
 
45
- 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).
45
+ Prettier handles almost everything, but the `isaacscript-lint` linting config also has a few formatting-related rules turned on, like [`isaacscript/format-jsdoc-comments`](https://github.com/IsaacScript/isaacscript/blob/main/packages/eslint-plugin-isaacscript/docs/rules/format-jsdoc-comments.md) (since Prettier does not format comments).
46
46
 
47
- 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/isaacscript/blob/main/packages/eslint-config-isaacscript/configs/base.js) file of the [`eslint-config-isaacscript`](https://github.com/IsaacScript/isaacscript/tree/main/packages/eslint-config-isaacscript) package.
47
+ ### ESLint
48
+
49
+ ESLint is the best tool to lint JavaScript and TypeScript, as it has a massive ecosystem of rules and plugins that can help find errors in your codebase.
50
+
51
+ In `isaacscript-lint`, the philosophy is that we want to enable as many lint rules as possible, so that we can catch as many bugs as possible. Of course, this is a tradeoff: with more lint rules, we get more false positives. But in general, a few false positives are worth the time saved from investigating and squashing bugs. False positives can be taken care of by adding a `// eslint-disable-next-line insert-rule-name-here` comment. (You can automatically add the comment by selecting "Quick Fix" in VSCode, which is mapped to `Ctrl + .` by default.)
52
+
53
+ In line with this philosophy, our linting config enables nearly all of the recommended rules from both the core ESLint team and the TypeScript ESLint team, as well as some additional custom rules that catch even more bugs. You can find a full list of the rules in the [`eslint-config-isaacscript`](https://github.com/IsaacScript/isaacscript/tree/main/packages/eslint-config-isaacscript) package.
54
+
55
+ ### Using Them Together
48
56
 
49
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.)
50
58
 
@@ -145,7 +153,7 @@ Create a `tsconfig.eslint.json` file in the root of your repository:
145
153
 
146
154
  ## Adding or Removing Rules
147
155
 
148
- You can add extra ESLint rules (or ignore existing ESLint rules) by editing the `rules` section of your `eslintrc.cjs` file. For example:
156
+ You can add extra ESLint rules (or ignore existing ESLint rules) by editing the `rules` section of your `.eslintrc.cjs` file. For example:
149
157
 
150
158
  ```js
151
159
  rules: {
@@ -176,7 +184,7 @@ Once installed, these extensions provide the a nice dichotomy:
176
184
 
177
185
  - Red squiggly underlines are type-errors from the TypeScript compiler.
178
186
  - Yellow squiggly underlines are warnings from ESLint. (Our config uses `eslint-plugin-only-warn` to convert all ESLint errors to warnings.)
179
- - Blue squiggly underlines are misspelled words. (You can right click --> `Spelling` --> `Add Words to CSpell Configuration` to ignore a specific word.)
187
+ - Blue squiggly underlines are misspelled words. (You can use "Quick Fix" to find suggestions for the proper spelling. Or, you can right click --> `Spelling` --> `Add Words to CSpell Configuration` to ignore a specific word.)
180
188
 
181
189
  #### `.vscode/settings.json`
182
190
 
@@ -237,14 +245,15 @@ Optionally, you can also provide a hint to anyone cloning your repository that t
237
245
  - [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) - Turns off all rules that conflict with Prettier.
238
246
  - [`eslint-plugin-deprecation`](https://github.com/gund/eslint-plugin-deprecation) - A plugin that finds deprecated code.
239
247
  - [`eslint-plugin-eslint-comments`](https://github.com/mysticatea/eslint-plugin-eslint-comments) - A plugin that provides rules relating to ESLint comments.
240
- - [`eslint-plugin-import`](https://github.com/benmosher/eslint-plugin-import) - Required as a peer dependency for `eslint-config-airbnb-base`.
248
+ - [`eslint-plugin-import`](https://github.com/benmosher/eslint-plugin-import) - Required as a peer dependency for `eslint-config-airbnb-base`. (Note that this uses the [`eslint-plugin-i`](https://github.com/un-es/eslint-plugin-i) fork under the hood.)
241
249
  - [`eslint-plugin-isaacscript`](https://github.com/IsaacScript/isaacscript/tree/main/packages/eslint-plugin-isaacscript) - A plugin that provides a collection of miscellaneous rules that help keep code safe.
242
250
  - [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc) - A plugin that provides rules for [JSDoc](https://en.wikipedia.org/wiki/JSDoc).
243
- - [`eslint-plugin-no-type-assertion`](https://github.com/Dremora/eslint-plugin-no-type-assertion) - A plugin that detects type assertions. (In the standard config, these rules are not turned on automatically, but they are useful in certain specific contexts.)
251
+ - [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n) - A plugin that provides rules for Node.js.
252
+ - [`eslint-plugin-no-autofix`](https://github.com/aladdin-add/eslint-plugin/tree/master) - A plugin that turns off the auto-fixer for some ESLint rules.
244
253
  - [`eslint-plugin-only-warn`](https://github.com/bfanger/eslint-plugin-only-warn) - A plugin that turns all errors to warnings.
245
- - [`eslint-plugin-sort-exports`](https://github.com/jrdrg/eslint-plugin-sort-exports) - A plugin that allows exports to be sorted alphabetically. (In the standard config, these rules are not turned on automatically, but they are useful in certain specific contexts.)
254
+ - [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn) - A plugin that provides some useful rules.
255
+ - [`knip`](https://github.com/webpro/knip) - A tool to look for unused files, dependencies, and exports.
246
256
  - [`prettier`](https://github.com/prettier/prettier) - This is the main code formatter, as explained above.
247
257
  - [`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.)
248
- - [`ts-prune`](https://github.com/nadeesha/ts-prune) - A tool to look for unused exports, which catches bugs that the `import/no-unused-modules` rule cannot find.
249
258
 
250
259
  <br>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-lint",
3
- "version": "4.16.9",
3
+ "version": "4.16.11",
4
4
  "description": "A linting dependency meta-package for IsaacScript and TypeScript projects.",
5
5
  "keywords": [
6
6
  "isaacscript",
@@ -21,31 +21,28 @@
21
21
  "author": "Zamiell",
22
22
  "type": "commonjs",
23
23
  "dependencies": {
24
- "@prettier/plugin-xml": "^2.2.0",
25
- "@tsconfig/recommended": "^1.0.2",
26
- "@typescript-eslint/eslint-plugin": "^5.56.0",
27
- "@typescript-eslint/parser": "^5.56.0",
28
- "cspell": "^6.30.2",
24
+ "@prettier/plugin-xml": "^3.1.1",
25
+ "@typescript-eslint/eslint-plugin": "^6.2.1",
26
+ "@typescript-eslint/parser": "^6.2.1",
27
+ "cspell": "^6.31.2",
29
28
  "cspell-check-unused-words": "^1.0.4",
30
- "eslint": "^8.36.0",
29
+ "eslint": "^8.46.0",
31
30
  "eslint-config-airbnb-base": "^15.0.0",
32
- "eslint-config-airbnb-typescript": "^17.0.0",
33
- "eslint-config-isaacscript": "^3.7.1",
34
- "eslint-config-prettier": "^8.8.0",
35
- "eslint-plugin-deprecation": "^1.3.3",
31
+ "eslint-config-airbnb-typescript": "^17.1.0",
32
+ "eslint-config-isaacscript": "^3.7.2",
33
+ "eslint-config-prettier": "^8.9.0",
34
+ "eslint-plugin-deprecation": "^1.5.0",
36
35
  "eslint-plugin-eslint-comments": "^3.2.0",
37
- "eslint-plugin-import": "^2.27.5",
38
- "eslint-plugin-isaacscript": "^2.6.7",
39
- "eslint-plugin-jsdoc": "^40.1.0",
40
- "eslint-plugin-n": "^15.6.1",
36
+ "eslint-plugin-import": "npm:eslint-plugin-i@latest",
37
+ "eslint-plugin-isaacscript": "^3.0.3",
38
+ "eslint-plugin-jsdoc": "^46.4.5",
39
+ "eslint-plugin-n": "^16.0.1",
41
40
  "eslint-plugin-no-autofix": "^1.2.3",
42
- "eslint-plugin-no-type-assertion": "^1.3.0",
43
41
  "eslint-plugin-only-warn": "^1.1.0",
44
- "eslint-plugin-sort-exports": "^0.8.0",
45
- "eslint-plugin-unicorn": "^46.0.0",
46
- "prettier": "^2.8.6",
47
- "prettier-plugin-organize-imports": "^3.2.2",
48
- "ts-prune-2": "^0.10.7"
42
+ "eslint-plugin-unicorn": "^48.0.1",
43
+ "knip": "^2.17.2",
44
+ "prettier": "^3.0.0",
45
+ "prettier-plugin-organize-imports": "^3.2.3"
49
46
  },
50
47
  "peerDependencies": {
51
48
  "typescript": ">= 4.0.0"