@bigcommerce/eslint-config 2.9.0 → 2.10.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/configs/base.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  env: {
3
4
  browser: true,
@@ -0,0 +1,5 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ extends: 'plugin:jest-dom/recommended',
4
+ plugins: ['jest-dom'],
5
+ };
package/configs/jest.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  env: {
3
4
  jest: true,
package/configs/jsdoc.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  plugins: ['jsdoc'],
3
4
  rules: {
@@ -1,13 +1,13 @@
1
- const { basename, dirname } = require('path');
2
- const { resolveConfigFile } = require('prettier');
1
+ const path = require('path');
3
2
 
4
3
  const defaultConfig = require('../prettier.config');
5
4
 
6
5
  function getRules() {
7
- const prettierConfigFile = resolveConfigFile.sync(process.cwd());
8
- const hasLocalConfig = prettierConfigFile ? dirname(prettierConfigFile) === process.cwd() : false;
6
+ const pkgPath = path.resolve(process.cwd(), 'package.json');
7
+ // eslint-disable-next-line import/no-dynamic-require
8
+ const pkg = require(pkgPath);
9
9
 
10
- if (!hasLocalConfig) {
10
+ if (pkg.prettier !== '@bigcommerce/eslint-config/prettier') {
11
11
  throw new Error(`
12
12
  =================================================================================
13
13
  Please add "prettier": "@bigcommerce/eslint-config/prettier" to your package.json
@@ -15,21 +15,13 @@ function getRules() {
15
15
  `);
16
16
  }
17
17
 
18
- if (basename(prettierConfigFile) !== 'package.json') {
19
- throw new Error(`
20
- =================================================================================
21
- Please add "prettier": "@bigcommerce/eslint-config/prettier" to your package.json
22
- and remove any other prettier config file
23
- =================================================================================
24
- `);
25
- }
26
-
27
18
  return {
28
19
  curly: ['error', 'all'],
29
20
  'prettier/prettier': ['warn', defaultConfig, { usePrettierrc: false }],
30
21
  };
31
22
  }
32
23
 
24
+ /** @type {import("eslint").Linter.Config} */
33
25
  module.exports = {
34
26
  extends: ['plugin:prettier/recommended'],
35
27
  rules: getRules(),
package/configs/react.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @type {import("eslint").Linter.Config} */
1
2
  module.exports = {
2
3
  extends: [
3
4
  'plugin:react/recommended',
@@ -0,0 +1,8 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ extends: ['plugin:testing-library/react'],
4
+ plugins: ['testing-library'],
5
+ rules: {
6
+ 'testing-library/no-render-in-lifecycle': 'off',
7
+ },
8
+ };
@@ -1,5 +1,6 @@
1
1
  const { join } = require('path');
2
2
 
3
+ /** @type {import("eslint").Linter.Config} */
3
4
  module.exports = {
4
5
  extends: [
5
6
  'plugin:import/typescript',
package/index.js CHANGED
@@ -7,6 +7,14 @@ module.exports = {
7
7
  extends: './configs/jest',
8
8
  files: ['**/*.spec.*', '**/spec.*', 'jest-setup.*'],
9
9
  },
10
+ hasPackage('@testing-library/jest-dom') && {
11
+ extends: './configs/jest-dom',
12
+ files: ['**/*.spec.*', '**/spec.*', 'jest-setup.*'],
13
+ },
14
+ hasPackage('@testing-library/react') && {
15
+ extends: './configs/testing-library',
16
+ files: ['**/*.spec.*', '**/spec.*', 'jest-setup.*'],
17
+ },
10
18
  hasPackage('react') && {
11
19
  extends: './configs/react',
12
20
  files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigcommerce/eslint-config",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "Default ESLint configuration used at BigCommerce",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -20,26 +20,30 @@
20
20
  "directory": "packages/eslint-config"
21
21
  },
22
22
  "dependencies": {
23
- "@bigcommerce/eslint-plugin": "^1.3.0",
23
+ "@bigcommerce/eslint-plugin": "^1.3.1",
24
24
  "@rushstack/eslint-patch": "^1.1.3",
25
25
  "@stylistic/eslint-plugin": "^2.1.0",
26
- "@typescript-eslint/eslint-plugin": "^7.8.0",
27
- "@typescript-eslint/parser": "^7.8.0",
26
+ "@typescript-eslint/eslint-plugin": "^8.4.0",
27
+ "@typescript-eslint/parser": "^8.4.0",
28
28
  "eslint-config-prettier": "^9.1.0",
29
29
  "eslint-import-resolver-typescript": "^3.5.2",
30
30
  "eslint-plugin-gettext": "^1.2.0",
31
31
  "eslint-plugin-import": "^2.26.0",
32
32
  "eslint-plugin-jest": "^28.4.0",
33
+ "eslint-plugin-jest-dom": "^5.5.0",
33
34
  "eslint-plugin-jest-formatting": "^3.1.0",
34
- "eslint-plugin-jsdoc": "^48.0.2",
35
+ "eslint-plugin-jsdoc": "^50.2.2",
35
36
  "eslint-plugin-jsx-a11y": "^6.5.1",
36
- "eslint-plugin-prettier": "^4.2.1",
37
+ "eslint-plugin-prettier": "^5.2.1",
37
38
  "eslint-plugin-react": "^7.29.4",
38
- "eslint-plugin-react-hooks": "^4.5.0",
39
+ "eslint-plugin-react-hooks": "^5.0.0",
39
40
  "eslint-plugin-switch-case": "^1.1.2",
40
- "prettier": "^2.8.8"
41
+ "eslint-plugin-testing-library": "^7.0.0",
42
+ "prettier": "^3.3.3"
41
43
  },
42
44
  "devDependencies": {
45
+ "@testing-library/jest-dom": "^6.6.3",
46
+ "@testing-library/react": "^16.0.1",
43
47
  "react": "^18.3.1"
44
48
  },
45
49
  "peerDependencies": {
@@ -51,5 +55,5 @@
51
55
  "optional": true
52
56
  }
53
57
  },
54
- "gitHead": "1550befd2d38dc65c4872b2cb45c4d22126f1e2d"
58
+ "gitHead": "6ab2382726d4770d615d5a55a9d4220e1c69af28"
55
59
  }