eslint-config-beslogic 2.4.8 → 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/README.md +1 -0
- package/javascript.js +34 -17
- package/lib/utils.js +6 -7
- package/package.json +1 -1
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 {
|
|
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
|
-
|
|
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
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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,
|
|
@@ -24,10 +24,8 @@ const getModuleVersion = (
|
|
|
24
24
|
const resolveModuleLocation = (/** @type {string} */ nodeModule) => {
|
|
25
25
|
try {
|
|
26
26
|
const resolved = require.resolve(nodeModule)
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
console.log(resolved.startsWith("/pc/clone/"))
|
|
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
|
}
|
|
@@ -87,6 +85,7 @@ module.exports = {
|
|
|
87
85
|
getModuleVersion,
|
|
88
86
|
idLenghtConfig,
|
|
89
87
|
jestFilePatterns,
|
|
88
|
+
isPreCommitCI,
|
|
90
89
|
jestNoRestrictedSyntax,
|
|
91
90
|
resolveModuleLocation
|
|
92
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-beslogic",
|
|
3
|
-
"version": "2.4.
|
|
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",
|