@cabify/eslint-config 2.1.4 → 3.0.1-beta-2

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,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.1.4] - 2024-09-12
11
+
10
12
  - Fixing dependencies not published properly in `v2.1.3`.
11
13
  - Revert eslint-plugin-lodash version bump because it requires ESLint v9.
12
14
 
package/configs/base.js CHANGED
@@ -1,52 +1,77 @@
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
+ name: 'base-cabify-eslint-config',
64
+ languageOptions: {
65
+ ecmaVersion: 2022,
66
+ sourceType: 'module',
67
+ globals: {
68
+ ...globals.browser,
69
+ ...globals.node,
70
+ },
71
+ },
72
+ rules: {
73
+ strict: 'error',
74
+ },
50
75
  },
51
- overrides,
52
- };
76
+ ...overrides,
77
+ ];
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'best-practices-cabify-eslint-config',
2
3
  rules: {
3
4
  // enforces getter/setter pairs in objects
4
5
  'accessor-pairs': 'off',
package/configs/errors.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'errors-cabify-eslint-config',
2
3
  rules: {
3
4
  // Enforce “for” loop update clause moving the counter in the right direction
4
5
  // https://eslint.org/docs/rules/for-direction
package/configs/es6.js CHANGED
@@ -1,15 +1,18 @@
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
+ name: 'ES6-cabify-eslint-config',
3
+ // languageOptions: {
4
+ // globals: {
5
+ // es6: true,
6
+ // },
7
+ // ecmaVersion: 6,
8
+ // sourceType: 'module',
9
+ // parserOptions: {
10
+ // ecmaFeatures: {
11
+ // generators: false,
12
+ // objectLiteralDuplicateProperties: false,
13
+ // },
14
+ // },
15
+ // },
13
16
 
14
17
  rules: {
15
18
  // verify super() callings in constructors
@@ -0,0 +1,6 @@
1
+ const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
2
+
3
+ module.exports = {
4
+ name: 'formats-cabify-eslint-config',
5
+ ...eslintPluginPrettierRecommended,
6
+ };
@@ -1,9 +1,17 @@
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
+ name: 'imports-cabify-eslint-config',
6
+ // languageOptions: {
7
+ // globals: {
8
+ // es6: true,
9
+ // },
10
+ // },
11
+ plugins: {
12
+ import: importPlugin,
13
+ 'simple-import-sort': simpleImportSort,
4
14
  },
5
- plugins: ['import', 'simple-import-sort'],
6
-
7
15
  settings: {
8
16
  'import/resolver': {
9
17
  node: {
@@ -107,7 +115,7 @@ module.exports = {
107
115
 
108
116
  // disallow AMD require/define
109
117
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
110
- 'import/no-amd': 'error',
118
+ // 'import/no-amd': 'error',
111
119
 
112
120
  // No Node.js builtin modules
113
121
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
@@ -155,7 +163,7 @@ module.exports = {
155
163
 
156
164
  // Require a newline after the last import/require in a group
157
165
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
158
- 'import/newline-after-import': 'error',
166
+ // 'import/newline-after-import': 'error',
159
167
 
160
168
  // Require modules with a single export to use a default export
161
169
  // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
package/configs/jest.js CHANGED
@@ -1,5 +1,14 @@
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
+ name: 'jest-cabify-eslint-config',
5
+ // languageOptions: {
6
+ // globals: {
7
+ // 'jest/globals': true,
8
+ // },
9
+ // },
10
+ rules: {
11
+ ...jest.configs['flat/recommended'],
12
+ ...jest.configs['flat/styles'],
13
+ },
5
14
  };
package/configs/lodash.js CHANGED
@@ -1,6 +1,8 @@
1
- module.exports = {
2
- plugins: ['lodash'],
1
+ const lodashPlugin = require('eslint-plugin-lodash');
3
2
 
3
+ module.exports = {
4
+ name: 'lodash-cabify-eslint-config',
5
+ plugins: { lodash: lodashPlugin },
4
6
  rules: {
5
7
  'lodash/import-scope': ['error', 'method'],
6
8
  },
package/configs/node.js CHANGED
@@ -1,8 +1,5 @@
1
1
  module.exports = {
2
- env: {
3
- node: true,
4
- },
5
-
2
+ name: 'node-cabify-eslint-config',
6
3
  rules: {
7
4
  // enforce return after a callback
8
5
  'callback-return': 'off',
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'post-css-cabify-eslint-config',
2
3
  rules: {
3
4
  'global-require': 'off',
4
5
  },
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'promises-cabify-eslint-config',
2
3
  rules: {
3
4
  'no-floating-promises': 'off',
4
5
 
@@ -1,11 +1,16 @@
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
+ name: 'react-a11y-cabify-eslint-config',
5
+ plugins: { 'jsx-a11y': jsxAllyPlugin },
6
+
7
+ // languageOptions: {
8
+ // parserOptions: {
9
+ // ecmaFeatures: {
10
+ // jsx: true,
11
+ // },
12
+ // },
13
+ // },
9
14
 
10
15
  rules: {
11
16
  // Enforce that anchors have content
package/configs/react.js CHANGED
@@ -1,9 +1,17 @@
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
+ name: 'react-cabify-eslint-config',
6
+ plugins: {
7
+ react,
8
+ 'react-hooks': reactHooks,
9
+ },
10
+ languageOptions: {
11
+ parserOptions: {
12
+ ecmaFeatures: {
13
+ jsx: true,
14
+ },
7
15
  },
8
16
  },
9
17
 
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'storybook-cabify-eslint-config',
2
3
  rules: {
3
4
  'import/no-default-export': 'off',
4
5
  },
package/configs/strict.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'strict-cabify-eslint-config',
2
3
  rules: {
3
4
  // babel inserts `'use strict';` for us
4
5
  strict: ['error', 'never'],
package/configs/style.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'style-cabify-eslint-config',
2
3
  rules: {
3
4
  // require camel case names
4
5
  // TODO: semver-major (eslint 5): add ignoreDestructuring: false option
package/configs/ts.js CHANGED
@@ -1,4 +1,5 @@
1
1
  module.exports = {
2
+ name: 'ts-cabify-eslint-config',
2
3
  plugins: ['@typescript-eslint'],
3
4
  extends: [
4
5
  'plugin:@typescript-eslint/recommended',
@@ -1,6 +1,7 @@
1
1
  const confusingBrowserGlobals = require('confusing-browser-globals');
2
2
 
3
3
  module.exports = {
4
+ name: 'variables-cabify-eslint-config',
4
5
  rules: {
5
6
  // enforce or disallow variable initializations at definition
6
7
  'init-declarations': 'off',
@@ -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-2",
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",
@@ -51,14 +49,15 @@
51
49
  "eslint-plugin-prettier": "^5.2.1",
52
50
  "eslint-plugin-react": "^7.36.0",
53
51
  "eslint-plugin-react-hooks": "^4.6.2",
54
- "eslint-plugin-simple-import-sort": "^12.1.1"
52
+ "eslint-plugin-simple-import-sort": "^12.1.1",
53
+ "globals": "^15.9.0"
55
54
  },
56
55
  "peerDependencies": {
57
- "eslint": ">= 8.0.1",
56
+ "eslint": "9.1.0",
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
- };