@cabify/eslint-config 2.1.4 → 3.0.1-beta

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
@@ -7,17 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- - Fixing dependencies not published properly in `v2.1.3`.
11
- - Revert eslint-plugin-lodash version bump because it requires ESLint v9.
12
-
13
- ## [2.1.3] - 2024-09-12
14
-
15
- - Updating eslint-plugin dependencies.
16
-
17
- ## [2.1.2] - 2024-09-12
18
-
19
- - Updating typescript-eslint dependencies.
20
-
21
10
  ## [2.1.1] - 2024-07-10
22
11
 
23
12
  - Updating naming convention for imports. Added `camelCase`, `PascalCase` and `UPPER_CASE`.
package/configs/base.js CHANGED
@@ -1,52 +1,76 @@
1
+ const globals = require('globals');
2
+
1
3
  const { isPackageAvailable } = require('../utils');
2
4
 
3
5
  const isTSAvailable = isPackageAvailable('typescript');
4
6
  const isJestAvailable = isPackageAvailable('jest');
5
7
 
8
+ const storybook = require('./storybook');
9
+ const ts = require('./ts');
10
+ const postcss = require('./postcss');
11
+
12
+ const bestPractices = require('./best-practices');
13
+ const errors = require('./errors');
14
+ const es6 = require('./es6');
15
+ const imports = require('./imports');
16
+ const node = require('./node');
17
+ const promises = require('./promises');
18
+ const strict = require('./strict');
19
+ const style = require('./style');
20
+ const variables = require('./variables');
21
+ const react = require('./react');
22
+ const lodash = require('./lodash');
23
+ const reactA11y = require('./react-a11y');
24
+ const jest = require('./jest');
25
+ const formats = require('./formats');
26
+
6
27
  const configs = [
7
- './best-practices',
8
- './errors',
9
- './es6',
10
- './imports',
11
- './node',
12
- './promises',
13
- './strict',
14
- './style',
15
- './variables',
16
- './react',
17
- './lodash',
18
- './react-a11y',
19
- isJestAvailable && './jest',
28
+ bestPractices,
29
+ errors,
30
+ es6,
31
+ imports,
32
+ node,
33
+ promises,
34
+ strict,
35
+ style,
36
+ variables,
37
+ react,
38
+ lodash,
39
+ reactA11y,
40
+ formats,
41
+ isJestAvailable && jest,
20
42
  ].filter(Boolean);
21
43
 
22
44
  const overrides = [
23
45
  isTSAvailable && {
24
46
  files: ['**/*.ts', '**/*.tsx'],
25
47
  excludedFiles: '*.d.ts',
26
- extends: ['./ts'],
48
+ ...ts,
27
49
  },
28
50
  {
29
51
  files: ['*.story.tsx', '*.stories.tsx'],
30
- extends: ['./storybook'],
52
+ ...storybook,
31
53
  },
32
54
  {
33
55
  files: ['postcss.config.js'],
34
- extends: ['./postcss'],
56
+ ...postcss,
35
57
  },
36
58
  ].filter(Boolean);
37
59
 
38
- module.exports = {
39
- env: {
40
- browser: true,
41
- node: true,
42
- },
43
- extends: configs,
44
- parserOptions: {
45
- ecmaVersion: 2018,
46
- sourceType: 'module',
47
- },
48
- rules: {
49
- strict: 'error',
60
+ module.exports = [
61
+ ...configs,
62
+ {
63
+ languageOptions: {
64
+ ecmaVersion: 2022,
65
+ sourceType: 'module',
66
+ globals: {
67
+ ...globals.browser,
68
+ ...globals.node,
69
+ },
70
+ },
71
+ rules: {
72
+ strict: 'error',
73
+ },
50
74
  },
51
- overrides,
52
- };
75
+ ...overrides,
76
+ ];
package/configs/es6.js CHANGED
@@ -1,15 +1,17 @@
1
1
  module.exports = {
2
- env: {
3
- es6: true,
4
- },
5
- parserOptions: {
6
- ecmaVersion: 6,
7
- sourceType: 'module',
8
- ecmaFeatures: {
9
- generators: false,
10
- objectLiteralDuplicateProperties: false,
11
- },
12
- },
2
+ // languageOptions: {
3
+ // globals: {
4
+ // es6: true,
5
+ // },
6
+ // ecmaVersion: 6,
7
+ // sourceType: 'module',
8
+ // parserOptions: {
9
+ // ecmaFeatures: {
10
+ // generators: false,
11
+ // objectLiteralDuplicateProperties: false,
12
+ // },
13
+ // },
14
+ // },
13
15
 
14
16
  rules: {
15
17
  // verify super() callings in constructors
@@ -0,0 +1,5 @@
1
+ const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
2
+
3
+ module.exports = {
4
+ ...eslintPluginPrettierRecommended,
5
+ };
@@ -1,9 +1,16 @@
1
+ const importPlugin = require('eslint-plugin-import');
2
+ const simpleImportSort = require('eslint-plugin-simple-import-sort');
3
+
1
4
  module.exports = {
2
- env: {
3
- es6: true,
5
+ // languageOptions: {
6
+ // globals: {
7
+ // es6: true,
8
+ // },
9
+ // },
10
+ plugins: {
11
+ import: importPlugin,
12
+ 'simple-import-sort': simpleImportSort,
4
13
  },
5
- plugins: ['import', 'simple-import-sort'],
6
-
7
14
  settings: {
8
15
  'import/resolver': {
9
16
  node: {
@@ -107,7 +114,7 @@ module.exports = {
107
114
 
108
115
  // disallow AMD require/define
109
116
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
110
- 'import/no-amd': 'error',
117
+ // 'import/no-amd': 'error',
111
118
 
112
119
  // No Node.js builtin modules
113
120
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
@@ -155,7 +162,7 @@ module.exports = {
155
162
 
156
163
  // Require a newline after the last import/require in a group
157
164
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
158
- 'import/newline-after-import': 'error',
165
+ // 'import/newline-after-import': 'error',
159
166
 
160
167
  // Require modules with a single export to use a default export
161
168
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
package/configs/jest.js CHANGED
@@ -1,5 +1,13 @@
1
+ const jest = require('eslint-plugin-jest');
2
+
1
3
  module.exports = {
2
- env: { 'jest/globals': true },
3
- plugins: ['jest'],
4
- extends: ['plugin:jest/recommended', 'plugin:jest/style'],
4
+ // languageOptions: {
5
+ // globals: {
6
+ // 'jest/globals': true,
7
+ // },
8
+ // },
9
+ rules: {
10
+ ...jest.configs['flat/recommended'],
11
+ ...jest.configs['flat/styles'],
12
+ },
5
13
  };
package/configs/lodash.js CHANGED
@@ -1,5 +1,7 @@
1
+ const lodashPlugin = require('eslint-plugin-lodash');
2
+
1
3
  module.exports = {
2
- plugins: ['lodash'],
4
+ plugins: { lodash: lodashPlugin },
3
5
 
4
6
  rules: {
5
7
  'lodash/import-scope': ['error', 'method'],
package/configs/node.js CHANGED
@@ -1,8 +1,4 @@
1
1
  module.exports = {
2
- env: {
3
- node: true,
4
- },
5
-
6
2
  rules: {
7
3
  // enforce return after a callback
8
4
  'callback-return': 'off',
@@ -1,11 +1,15 @@
1
- module.exports = {
2
- plugins: ['jsx-a11y', 'react'],
1
+ const jsxAllyPlugin = require('eslint-plugin-jsx-a11y');
3
2
 
4
- parserOptions: {
5
- ecmaFeatures: {
6
- jsx: true,
7
- },
8
- },
3
+ module.exports = {
4
+ plugins: { 'jsx-a11y': jsxAllyPlugin },
5
+
6
+ // languageOptions: {
7
+ // parserOptions: {
8
+ // ecmaFeatures: {
9
+ // jsx: true,
10
+ // },
11
+ // },
12
+ // },
9
13
 
10
14
  rules: {
11
15
  // Enforce that anchors have content
package/configs/react.js CHANGED
@@ -1,9 +1,16 @@
1
- module.exports = {
2
- plugins: ['react', 'react-hooks'],
1
+ const react = require('eslint-plugin-react');
2
+ const reactHooks = require('eslint-plugin-react-hooks');
3
3
 
4
- parserOptions: {
5
- ecmaFeatures: {
6
- jsx: true,
4
+ module.exports = {
5
+ plugins: {
6
+ react,
7
+ 'react-hooks': reactHooks,
8
+ },
9
+ languageOptions: {
10
+ parserOptions: {
11
+ ecmaFeatures: {
12
+ jsx: true,
13
+ },
7
14
  },
8
15
  },
9
16
 
@@ -0,0 +1,3 @@
1
+ const recommended = require('./recommended');
2
+
3
+ module.exports = [...recommended];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabify/eslint-config",
3
- "version": "2.1.4",
3
+ "version": "3.0.1-beta",
4
4
  "description": "ESLint config for Cabify Javascript projects",
5
5
  "scripts": {
6
6
  "build": "echo 'No build to perform'",
@@ -33,11 +33,9 @@
33
33
  "style",
34
34
  "standards"
35
35
  ],
36
- "main": "./legacy.js",
36
+ "main": "../recommended.js",
37
37
  "exports": {
38
- ".": "./legacy.js",
39
- "./legacy": "./legacy.js",
40
- "./recommended": "./recommended.js"
38
+ ".": "./recommended.js"
41
39
  },
42
40
  "dependencies": {
43
41
  "@typescript-eslint/eslint-plugin": "^8.4.0",
@@ -45,20 +43,21 @@
45
43
  "confusing-browser-globals": "^1.0.10",
46
44
  "eslint-config-prettier": "^9.1.0",
47
45
  "eslint-plugin-import": "^2.30.0",
48
- "eslint-plugin-jest": "^28.8.3",
49
- "eslint-plugin-jsx-a11y": "^6.10.0",
50
- "eslint-plugin-lodash": "^7.4.0",
46
+ "eslint-plugin-jest": "^28.2.0",
47
+ "eslint-plugin-jsx-a11y": "^6.8.0",
48
+ "eslint-plugin-lodash": "^7.3.0",
51
49
  "eslint-plugin-prettier": "^5.2.1",
52
- "eslint-plugin-react": "^7.36.0",
53
- "eslint-plugin-react-hooks": "^4.6.2",
54
- "eslint-plugin-simple-import-sort": "^12.1.1"
50
+ "eslint-plugin-react": "^7.35.2",
51
+ "eslint-plugin-react-hooks": "^4.3.0",
52
+ "eslint-plugin-simple-import-sort": "^12.1.0",
53
+ "globals": "^13.6.0"
55
54
  },
56
55
  "peerDependencies": {
57
56
  "eslint": ">= 8.0.1",
58
57
  "prettier": ">= 2.2.1"
59
58
  },
60
59
  "devDependencies": {
61
- "eslint": "8.57.0",
60
+ "eslint": "9.1.0",
62
61
  "prettier": "3.3.3"
63
62
  },
64
63
  "publishConfig": {
package/recommended.js CHANGED
@@ -1,3 +1,4 @@
1
- module.exports = {
2
- extends: ['./configs/base', 'prettier'],
3
- };
1
+ const base = require('./configs/base');
2
+ const eslintConfigPrettier = require('eslint-config-prettier');
3
+
4
+ module.exports = [...base, eslintConfigPrettier];
package/utils.js CHANGED
@@ -3,6 +3,7 @@ module.exports = {
3
3
  try {
4
4
  // eslint-disable-next-line global-require, import/no-dynamic-require
5
5
  return !!require(packageName);
6
+ // eslint-disable-next-line no-unused-vars
6
7
  } catch (e) {
7
8
  return false;
8
9
  }
package/.eslintrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['./recommended.js'],
3
- };
package/configs/format.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- plugins: ['prettier'],
3
- extends: ['plugin:prettier/recommended', 'prettier'],
4
- };
package/legacy.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['./configs/base', './configs/format'],
3
- };