@gitlab/eslint-plugin 20.7.1 → 21.1.0

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.
@@ -1,6 +1,4 @@
1
- const [, ...restrictedGlobals] = require('eslint-config-airbnb-base/rules/variables').rules[
2
- 'no-restricted-globals'
3
- ];
1
+ const confusingBrowserGlobals = require('confusing-browser-globals');
4
2
 
5
3
  /*
6
4
  This plugin contains rules related to GitLab JavaScript style guide
@@ -11,7 +9,20 @@ module.exports = {
11
9
  browser: true,
12
10
  es2020: true,
13
11
  },
14
- extends: ['airbnb-base', 'prettier', 'plugin:promise/recommended'],
12
+ extends: [
13
+ ...[
14
+ './base/best-practices.js',
15
+ './base/errors',
16
+ './base/node',
17
+ './base/style',
18
+ './base/variables',
19
+ './base/es6',
20
+ './base/imports',
21
+ './base/strict',
22
+ ].map((f) => require.resolve(f)),
23
+ 'prettier',
24
+ 'plugin:promise/recommended',
25
+ ],
15
26
  parserOptions: {
16
27
  parser: 'espree',
17
28
  ecmaVersion: 'latest',
@@ -71,7 +82,16 @@ module.exports = {
71
82
  ],
72
83
  'no-restricted-globals': [
73
84
  'error',
74
- ...restrictedGlobals,
85
+ {
86
+ name: 'isFinite',
87
+ message:
88
+ 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
89
+ },
90
+ {
91
+ name: 'isNaN',
92
+ message:
93
+ 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
94
+ },
75
95
  {
76
96
  name: 'escape',
77
97
  message:
@@ -82,7 +102,7 @@ module.exports = {
82
102
  message:
83
103
  "The global `unescape` function is unsafe. Did you mean to use `decodeURI`, `decodeURIComponent` or lodash's `unescape` instead?",
84
104
  },
85
- ],
105
+ ].concat(confusingBrowserGlobals),
86
106
  'import/order': [
87
107
  'error',
88
108
  {
@@ -90,6 +110,6 @@ module.exports = {
90
110
  },
91
111
  ],
92
112
  // https://docs.gitlab.com/ee/development/fe_guide/style/javascript.html#limit-number-of-parameters
93
- 'max-params': ['error', { max: 3 }]
113
+ 'max-params': ['error', { max: 3 }],
94
114
  },
95
115
  };
@@ -4,7 +4,7 @@ const vueConfig = require('./vue');
4
4
  module.exports = {
5
5
  ...baseConfig,
6
6
  extends: [
7
- 'airbnb-base',
7
+ ...baseConfig.extends,
8
8
  'prettier',
9
9
  'plugin:promise/recommended',
10
10
  'plugin:vue/recommended',
@@ -9,9 +9,12 @@ module.exports = {
9
9
  ignoreTypeOfDescribeName: true,
10
10
  },
11
11
  ],
12
- 'jest/no-restricted-matchers': ['error', {
13
- toBeFalsy: 'Prefer a stronger matcher like `toBe(false)`',
14
- toBeTruthy: 'Prefer a stronger matcher like `toBe(true)`'
15
- }]
12
+ 'jest/no-restricted-matchers': [
13
+ 'error',
14
+ {
15
+ toBeFalsy: 'Prefer a stronger matcher like `toBe(false)`',
16
+ toBeTruthy: 'Prefer a stronger matcher like `toBe(true)`',
17
+ },
18
+ ],
16
19
  },
17
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/eslint-plugin",
3
- "version": "20.7.1",
3
+ "version": "21.1.0",
4
4
  "description": "GitLab package for our custom eslint rules",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@typescript-eslint/eslint-plugin": "^7.14.1",
34
- "eslint-config-airbnb-base": "^15.0.0",
34
+ "confusing-browser-globals": "^1.0.11",
35
35
  "eslint-config-prettier": "^9.1.0",
36
36
  "eslint-plugin-import": "^2.29.1",
37
37
  "eslint-plugin-jest": "^28.6.0",