@shelf/eslint-config 1.8.2 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,2 +1,8 @@
1
+ ## 2.0.0
2
+
3
+ Removed separate file for testing-library, added testing-library rules to `frontend-typescript.js`.
4
+ Extended `frontend.js` in `frontend-typescript.js` and `frontend-typescript-vue.js`.
5
+
1
6
  ## 1.0.0
7
+
2
8
  Breaking changes of the eslint-config-prettier 8.0.0
@@ -1,34 +1,24 @@
1
- const importOrder = require('./rules/import-order.json');
2
- const sortImports = require('./rules/sort-imports.json');
3
1
  const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./rules/overrides');
4
2
  const consistentTypeAssertions = require('./rules/consistent-type-assertions.json');
3
+ const vueConfig = require('./frontend-vue');
5
4
 
6
5
  module.exports = {
7
6
  extends: [
8
- '@shelf/eslint-config',
7
+ './frontend-vue',
9
8
  'plugin:@typescript-eslint/eslint-recommended',
10
9
  'plugin:@typescript-eslint/recommended',
11
- 'plugin:prettier/recommended',
12
- 'plugin:vue/essential',
13
10
  ],
14
- plugins: ['@typescript-eslint', 'vue', 'babel', 'jsx', 'import'],
15
- env: {
16
- browser: true,
17
- },
11
+ plugins: ['@typescript-eslint', ...vueConfig.plugins],
18
12
  parserOptions: {
13
+ ...vueConfig.parserOptions,
19
14
  parser: '@typescript-eslint/parser',
20
- ecmaFeatures: {
21
- jsx: true,
22
- },
23
15
  },
24
16
  rules: {
25
- ...importOrder,
26
- ...sortImports,
17
+ ...vueConfig.rules,
27
18
  '@typescript-eslint/no-use-before-define': 0,
28
19
  '@typescript-eslint/camelcase': 0,
29
20
  '@typescript-eslint/explicit-member-accessibility': 0,
30
21
  'jest/lowercase-name': 'off',
31
- 'comma-dangle': 'off',
32
22
  ...consistentTypeAssertions,
33
23
  },
34
24
  overrides: [allowRequireInConfigs, noExplicitReturnTypeInTests],
@@ -1,28 +1,19 @@
1
1
  const commonExtends = require('./rules/extends-common.json');
2
2
  const commonPlugins = require('./common/plugins');
3
- const env = require('./common/env');
4
- const importOrder = require('./rules/import-order.json');
5
- const jestRules = require('./rules/jest.json');
6
- const paddingLineBetweenStatements = require('./rules/padding-line-between-statements');
7
- const preferDestructuring = require('./rules/prefer-destructuring');
8
- const sortImports = require('./rules/sort-imports.json');
9
3
  const tsParser = require('./common/ts-parser');
10
4
  const {allowRequireInConfigs, noExplicitReturnTypeInTests} = require('./rules/overrides');
11
5
  const consistentTypeAssertions = require('./rules/consistent-type-assertions.json');
6
+ const frontendConfig = require('./frontend');
12
7
 
13
8
  module.exports = {
14
- extends: [...commonExtends, 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
9
+ extends: ['./frontend.js', ...commonExtends],
15
10
  globals: {
16
11
  DD_LOGS: true,
17
12
  },
18
- plugins: [...commonPlugins, 'react'],
19
- env: {
20
- ...env,
21
- browser: true,
22
- },
13
+ plugins: [...commonPlugins, ...frontendConfig.plugins, 'testing-library'],
23
14
  ...tsParser,
24
15
  rules: {
25
- 'prettier/prettier': 'error',
16
+ ...frontendConfig.rules,
26
17
  '@typescript-eslint/no-use-before-define': 0,
27
18
  '@typescript-eslint/camelcase': 0,
28
19
  // it fail to compile TS on react static class properties (displayName | defaultProps | etc..)
@@ -33,17 +24,24 @@ module.exports = {
33
24
  '@typescript-eslint/no-empty-function': 'off',
34
25
  'react/prop-types': 'off',
35
26
  'react/display-name': 'warn',
36
- 'padding-line-between-statements': paddingLineBetweenStatements,
37
- ...jestRules,
38
- ...preferDestructuring,
39
- 'prefer-template': 'error',
40
- 'prefer-object-spread': 'error',
41
- ...importOrder,
42
- ...sortImports,
43
27
  '@typescript-eslint/no-unused-vars': 'error',
44
- 'comma-dangle': 'off',
45
- 'no-console': 'error',
46
28
  ...consistentTypeAssertions,
29
+ 'testing-library/await-async-query': 'error',
30
+ 'testing-library/no-await-sync-query': 'error',
31
+ 'testing-library/no-debug': 'warn',
32
+ 'testing-library/consistent-data-testid': [
33
+ 2,
34
+ {
35
+ testIdPattern: '^(([a-z])+(-)*)+$',
36
+ },
37
+ ],
47
38
  },
48
- overrides: [allowRequireInConfigs, noExplicitReturnTypeInTests],
39
+ overrides: [
40
+ allowRequireInConfigs,
41
+ noExplicitReturnTypeInTests,
42
+ {
43
+ files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
44
+ extends: ['plugin:testing-library/react'],
45
+ },
46
+ ],
49
47
  };
package/frontend-vue.js CHANGED
@@ -1,7 +1,5 @@
1
- const importOrder = require('./rules/import-order.json');
2
-
3
1
  module.exports = {
4
- extends: ['@shelf/eslint-config', 'plugin:prettier/recommended', 'plugin:vue/essential'],
2
+ extends: ['./base.js', 'plugin:vue/essential'],
5
3
  plugins: ['vue', 'babel', 'jsx', 'import'],
6
4
  env: {
7
5
  browser: true,
@@ -12,8 +10,4 @@ module.exports = {
12
10
  jsx: true,
13
11
  },
14
12
  },
15
- rules: {
16
- ...importOrder,
17
- 'comma-dangle': 'off',
18
- },
19
13
  };
package/frontend.js CHANGED
@@ -1,13 +1,8 @@
1
- const importOrder = require('./rules/import-order.json');
2
1
  const env = require('./common/env');
2
+ const baseConfig = require('./base');
3
3
 
4
4
  module.exports = {
5
- extends: [
6
- '@shelf/eslint-config',
7
- 'plugin:react/recommended',
8
- 'prettier',
9
- 'plugin:react-hooks/recommended',
10
- ],
5
+ extends: ['./base.js', 'plugin:react/recommended', 'prettier', 'plugin:react-hooks/recommended'],
11
6
  plugins: ['react', 'import'],
12
7
  env: {
13
8
  browser: true,
@@ -20,8 +15,7 @@ module.exports = {
20
15
  },
21
16
  },
22
17
  rules: {
23
- ...importOrder,
24
- 'comma-dangle': 'off',
18
+ ...baseConfig.rules,
25
19
  'no-console': 'error',
26
20
  },
27
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shelf/eslint-config",
3
- "version": "1.8.2",
3
+ "version": "2.2.0",
4
4
  "description": "ESLint Config for Shelf Projects",
5
5
  "license": "MIT",
6
6
  "repository": "shelfio/eslint-config",
@@ -23,7 +23,6 @@
23
23
  "frontend-vue.js",
24
24
  "frontend-typescript.js",
25
25
  "frontend-typescript-vue.js",
26
- "frontend-testing-library.js",
27
26
  "meteor.js",
28
27
  "typescript.js"
29
28
  ],
@@ -34,13 +33,13 @@
34
33
  ],
35
34
  "dependencies": {
36
35
  "@babel/eslint-parser": "7.15.0",
37
- "@typescript-eslint/eslint-plugin": "4.29.3",
38
- "@typescript-eslint/parser": "4.29.3",
39
- "eslint-config-next": "11.0.1",
36
+ "@typescript-eslint/eslint-plugin": "4.33.0",
37
+ "@typescript-eslint/parser": "4.33.0",
38
+ "eslint-config-next": "11.1.2",
40
39
  "eslint-config-prettier": "8.3.0",
41
40
  "eslint-plugin-babel": "5.3.1",
42
41
  "eslint-plugin-import": "2.24.2",
43
- "eslint-plugin-jest": "24.4.0",
42
+ "eslint-plugin-jest": "24.4.3",
44
43
  "eslint-plugin-jest-formatting": "3.0.0",
45
44
  "eslint-plugin-json-format": "2.0.1",
46
45
  "eslint-plugin-jsx": "0.1.0",
@@ -53,7 +52,7 @@
53
52
  "devDependencies": {
54
53
  "husky": "4.3.8",
55
54
  "lint-staged": "11.1.2",
56
- "prettier": "2.3.2"
55
+ "prettier": "2.4.0"
57
56
  },
58
57
  "peerDependencies": {
59
58
  "eslint": "7.x",
package/typescript.js CHANGED
@@ -16,7 +16,9 @@ module.exports = {
16
16
  env,
17
17
  ...tsParser,
18
18
  rules: {
19
- complexity: ['warn', {max: 6}],
19
+ complexity: ['warn', {max: 5}],
20
+ curly: 'error',
21
+ 'no-nested-ternary': 'error',
20
22
  'prettier/prettier': 'error',
21
23
  '@typescript-eslint/no-use-before-define': 0,
22
24
  '@typescript-eslint/camelcase': 0,
@@ -1,15 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:testing-library/react'],
3
- plugins: ['testing-library'],
4
- rules: {
5
- 'testing-library/await-async-query': 'error',
6
- 'testing-library/no-await-sync-query': 'error',
7
- 'testing-library/no-debug': 'warn',
8
- 'testing-library/consistent-data-testid': [
9
- 2,
10
- {
11
- testIdPattern: '^(([a-z])+(-)*)+$',
12
- },
13
- ],
14
- },
15
- };