eslint-config-beslogic 2.4.8 → 2.4.10
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 +35 -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,10 @@ 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")
|
|
25
|
+
console.log({ hasEtc, hasNoAutofix, hasEslintComments })
|
|
16
26
|
|
|
17
27
|
const commaDangleDefault = "always-multiline"
|
|
18
28
|
|
|
@@ -55,7 +65,9 @@ module.exports = {
|
|
|
55
65
|
"plugin:unicorn/all",
|
|
56
66
|
"plugin:regexp/all",
|
|
57
67
|
"plugin:import/recommended",
|
|
58
|
-
|
|
68
|
+
...hasEslintComments
|
|
69
|
+
? ["plugin:@eslint-community/eslint-comments/recommended"]
|
|
70
|
+
: []
|
|
59
71
|
],
|
|
60
72
|
"parserOptions": {
|
|
61
73
|
"requireConfigFile": false,
|
|
@@ -342,12 +354,14 @@ module.exports = {
|
|
|
342
354
|
* @eslint-community/eslint-comments/recommended overrides (https://eslint-community.github.io/eslint-plugin-eslint-comments/rules)
|
|
343
355
|
*/
|
|
344
356
|
// 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
|
-
|
|
357
|
+
"@eslint-community/eslint-comments/disable-enable-pair": hasEslintComments
|
|
358
|
+
? [
|
|
359
|
+
"error",
|
|
360
|
+
{
|
|
361
|
+
"allowWholeFile": true
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
: "off"
|
|
351
365
|
}
|
|
352
366
|
},
|
|
353
367
|
{
|
|
@@ -389,16 +403,20 @@ module.exports = {
|
|
|
389
403
|
}
|
|
390
404
|
],
|
|
391
405
|
"rules": {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
406
|
+
...hasEslintComments
|
|
407
|
+
? {
|
|
408
|
+
/*
|
|
409
|
+
* @eslint-community/eslint-comments/recommended overrides (https://eslint-community.github.io/eslint-plugin-eslint-comments/rules)
|
|
410
|
+
*/
|
|
411
|
+
"@eslint-community/eslint-comments/no-unused-disable": "error",
|
|
412
|
+
"@eslint-community/eslint-comments/require-description": [
|
|
413
|
+
"error",
|
|
414
|
+
{
|
|
415
|
+
"ignore": ["eslint-enable"]
|
|
416
|
+
}
|
|
417
|
+
]
|
|
400
418
|
}
|
|
401
|
-
|
|
419
|
+
: {},
|
|
402
420
|
|
|
403
421
|
/*
|
|
404
422
|
* 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.10",
|
|
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",
|