eslint-config-beslogic 2.4.7 → 2.4.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.8
4
+
5
+ Go back to explicit `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin` dependencies instead of `typescript-eslint` due to <https://github.com/danielnixon/eslint-plugin-total-functions/issues/477#issuecomment-2327088201>.
6
+
3
7
  ## 2.4.7
4
8
 
5
9
  - No longer recommending to explicitely annotate void returning awaitable arrow functions as `(param): void => { statement }` in JavaScript.
package/README.md CHANGED
@@ -84,6 +84,7 @@ In the `additional_dependencies` field, you'll need to include _all_ the plugins
84
84
  As you'll easily bust the 250MiB limit on the free tier, omit the following dependencies as they're special-cased to always be ignored on `pre-commit.ci` anyway:
85
85
 
86
86
  - `dprint`
87
+ - `@eslint-community/eslint-plugin-eslint-comments`
87
88
  - `eslint-plugin-total-functions`
88
89
  - `esling-plugin-no-autofix`
89
90
  - `eslint-plugin-testing-library`
package/javascript.js CHANGED
@@ -2,7 +2,13 @@
2
2
  // Copyright 2024 Beslogic Inc.
3
3
 
4
4
  const restrictedGlobals = require("confusing-browser-globals")
5
- const { jestNoRestrictedSyntax, jestFilePatterns, resolveModuleLocation, idLenghtConfig } = require(
5
+ const {
6
+ jestNoRestrictedSyntax,
7
+ jestFilePatterns,
8
+ resolveModuleLocation,
9
+ idLenghtConfig,
10
+ isPreCommitCI
11
+ } = require(
6
12
  "./lib/utils"
7
13
  )
8
14
 
@@ -13,6 +19,9 @@ const hasEtc = !!resolveModuleLocation("eslint-plugin-etc")
13
19
  // https://github.com/aladdin-add/eslint-plugin/issues/98
14
20
  // Even if it gets fixed, `no-autofix` rules necessarily don't provide fixes anyway
15
21
  const hasNoAutofix = !!resolveModuleLocation("eslint-plugin-no-autofix")
22
+ // @eslint-community/eslint-comments' only autofix is removing unused suppression comments
23
+ // Some rules get globally disabled for pre-commit.ci, so finding unused comments is expected
24
+ const hasEslintComments = !!resolveModuleLocation("@eslint-community/eslint-comments")
16
25
 
17
26
  const commaDangleDefault = "always-multiline"
18
27
 
@@ -55,7 +64,9 @@ module.exports = {
55
64
  "plugin:unicorn/all",
56
65
  "plugin:regexp/all",
57
66
  "plugin:import/recommended",
58
- "plugin:@eslint-community/eslint-comments/recommended"
67
+ ...hasEslintComments
68
+ ? ["plugin:@eslint-community/eslint-comments/recommended"]
69
+ : []
59
70
  ],
60
71
  "parserOptions": {
61
72
  "requireConfigFile": false,
@@ -342,12 +353,14 @@ module.exports = {
342
353
  * @eslint-community/eslint-comments/recommended overrides (https://eslint-community.github.io/eslint-plugin-eslint-comments/rules)
343
354
  */
344
355
  // TODO: Move back to "all files" once HTML parsing crash is fixed https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/162
345
- "@eslint-community/eslint-comments/disable-enable-pair": [
346
- "error",
347
- {
348
- "allowWholeFile": true
349
- }
350
- ]
356
+ "@eslint-community/eslint-comments/disable-enable-pair": hasEslintComments
357
+ ? [
358
+ "error",
359
+ {
360
+ "allowWholeFile": true
361
+ }
362
+ ]
363
+ : "off"
351
364
  }
352
365
  },
353
366
  {
@@ -389,16 +402,20 @@ module.exports = {
389
402
  }
390
403
  ],
391
404
  "rules": {
392
- /*
393
- * @eslint-community/eslint-comments/recommended overrides (https://eslint-community.github.io/eslint-plugin-eslint-comments/rules)
394
- */
395
- "@eslint-community/eslint-comments/no-unused-disable": "error",
396
- "@eslint-community/eslint-comments/require-description": [
397
- "error",
398
- {
399
- "ignore": ["eslint-enable"]
405
+ ...hasEslintComments
406
+ ? {
407
+ /*
408
+ * @eslint-community/eslint-comments/recommended overrides (https://eslint-community.github.io/eslint-plugin-eslint-comments/rules)
409
+ */
410
+ "@eslint-community/eslint-comments/no-unused-disable": "error",
411
+ "@eslint-community/eslint-comments/require-description": [
412
+ "error",
413
+ {
414
+ "ignore": ["eslint-enable"]
415
+ }
416
+ ]
400
417
  }
401
- ],
418
+ : {},
402
419
 
403
420
  /*
404
421
  * sonarjs/recommended overrides (https://github.com/SonarSource/eslint-plugin-sonarjs#rules)
package/lib/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- // const isPreCommitCI = __dirname.startsWith("/pc/clone/")
2
- // console.log(__dirname)
3
- // console.log(__filename)
1
+ const isPreCommitCI = __dirname.startsWith("/pc/clone/")
2
+ console.log(__dirname)
3
+ console.log(__filename)
4
4
 
5
5
  const getModuleVersion = (
6
6
  /** @type {string} */ nodeModule,
@@ -23,11 +23,9 @@ const getModuleVersion = (
23
23
 
24
24
  const resolveModuleLocation = (/** @type {string} */ nodeModule) => {
25
25
  try {
26
- // console.log(__dirname)
27
- // console.log(__filename)
28
26
  const resolved = require.resolve(nodeModule)
29
- // DEBUG: console.log(resolved)
30
- if (resolved.startsWith("/pc/clone/")) {
27
+ // equivalent to resolved.startsWith("/pc/clone/"))
28
+ if (isPreCommitCI) {
31
29
  // Assume it's omitted from the pre-commit.ci run
32
30
  return false
33
31
  }
@@ -86,8 +84,8 @@ const idLenghtConfig = {
86
84
  module.exports = {
87
85
  getModuleVersion,
88
86
  idLenghtConfig,
89
- // isPreCommitCI,
90
87
  jestFilePatterns,
88
+ isPreCommitCI,
91
89
  jestNoRestrictedSyntax,
92
90
  resolveModuleLocation
93
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-beslogic",
3
- "version": "2.4.7",
3
+ "version": "2.4.9",
4
4
  "description": "ESLint rules, plugins and configs used at Beslogic",
5
5
  "main": "index.js",
6
6
  "// dependencies": "Run for ourselves when we install dependencies w/o running npm i afterward",
@@ -39,9 +39,12 @@
39
39
  "author": "Samuel Therrien <samuel.therrien@beslogic.com>",
40
40
  "license": "MIT",
41
41
  "// @babel/eslint-parser": "Bumped json5 to fix prototype Pollution in minimist <1.2.6",
42
+ "// typescript-eslint": "Can't use the proxy package because of total-functions: https://github.com/danielnixon/eslint-plugin-total-functions/issues/477#issuecomment-2327088201",
42
43
  "dependencies": {
43
44
  "@babel/eslint-parser": "^7.20.12",
44
45
  "@eslint-community/eslint-plugin-eslint-comments": "^4.1",
46
+ "@typescript-eslint/eslint-plugin": "^7.4",
47
+ "@typescript-eslint/parser": "^7.4",
45
48
  "confusing-browser-globals": "^1.0",
46
49
  "dprint": "^0.40.2",
47
50
  "eslint": "^8.56",
@@ -60,8 +63,7 @@
60
63
  "eslint-plugin-sonarjs": "^1.0",
61
64
  "eslint-plugin-testing-library": "^6.0",
62
65
  "eslint-plugin-unicorn": ">=49.0",
63
- "eslint-plugin-unused-imports": "^3.2",
64
- "typescript-eslint": "^7.4"
66
+ "eslint-plugin-unused-imports": "^3.2"
65
67
  },
66
68
  "// eslint-plugin-total-functions": "Supported version is dictated by TypeScript and ESLint",
67
69
  "// (cont)": "Also made optional because of extra strictness",