@bedrockio/eslint-plugin 1.0.0 → 1.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.
@@ -0,0 +1,12 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "targets": {
7
+ "node": "current"
8
+ }
9
+ }
10
+ ]
11
+ ]
12
+ }
package/package.json CHANGED
@@ -1,27 +1,33 @@
1
1
  {
2
2
  "name": "@bedrockio/eslint-plugin",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Common ESLint plugin for Bedrock projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
+ "scripts": {
8
+ "build": "scripts/build",
9
+ "prepublishOnly": "yarn build"
10
+ },
7
11
  "keywords": [
8
12
  "eslint",
9
13
  "eslintplugin",
10
14
  "eslint-plugin"
11
15
  ],
12
- "main": "index.js",
16
+ "exports": {
17
+ "import": "./src/index.js",
18
+ "require": "./dist/cjs/index.js"
19
+ },
13
20
  "dependencies": {
14
- "@eslint/compat": "^1.0.1",
15
- "@eslint/js": "^9.2.0",
16
- "eslint-plugin-import": "^2.29.1",
17
- "eslint-plugin-jest": "^28.5.0",
21
+ "@eslint/js": "^9.19.0",
22
+ "eslint-plugin-import": "^2.31.0",
23
+ "eslint-plugin-jest": "^28.11.0",
18
24
  "eslint-plugin-mdx": "^3.1.5",
19
- "eslint-plugin-react": "^7.34.1",
20
- "globals": "^15.2.0"
25
+ "eslint-plugin-react": "^7.37.4",
26
+ "globals": "^15.14.0"
21
27
  },
22
28
  "peerDependencies": {
23
29
  "eslint": ">=9",
24
- "eslint-import-resolver-webpack": "^0.13.8"
30
+ "eslint-import-resolver-webpack": "^0.13.10"
25
31
  },
26
32
  "peerDependenciesMeta": {
27
33
  "eslint-import-resolver-webpack": {
@@ -35,8 +41,11 @@
35
41
  }
36
42
  },
37
43
  "devDependencies": {
44
+ "@babel/cli": "^7.26.4",
45
+ "@babel/core": "^7.26.7",
46
+ "@babel/preset-env": "^7.26.7",
38
47
  "eslint": "^9.2.0",
39
- "eslint-import-resolver-webpack": "^0.13.8"
48
+ "eslint-import-resolver-webpack": "^0.13.10"
40
49
  },
41
50
  "volta": {
42
51
  "node": "20.12.2",
package/scripts/build ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ rm -rf dist
3
+ mkdir -p dist/cjs
4
+ echo "{ \"type\": \"commonjs\" }" > dist/cjs/package.json
5
+ babel src -d dist/cjs $@
@@ -6,14 +6,12 @@ import { default as nodeImports } from './node-imports.js';
6
6
  import { default as webpackImports } from './webpack-imports.js';
7
7
  import { default as typescriptImports } from './typescript-imports.js';
8
8
 
9
- export default {
10
- configs: {
11
- mdx,
12
- jest,
13
- react,
14
- recommended,
15
- nodeImports,
16
- webpackImports,
17
- typescriptImports,
18
- },
9
+ export {
10
+ mdx,
11
+ jest,
12
+ react,
13
+ recommended,
14
+ nodeImports,
15
+ webpackImports,
16
+ typescriptImports,
19
17
  };
@@ -1,13 +1,17 @@
1
1
  import plugin from 'eslint-plugin-jest';
2
- import globals from 'globals';
3
2
 
4
3
  export default {
5
4
  ...plugin.configs['flat/recommended'],
6
- files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
5
+
6
+ files: ['**/*.{js,jsx,ts,tsx}'],
7
+ files: [
8
+ '**/__tests__/**/*.{js,jsx,ts,tsx}',
9
+ '**/__mocks__/**/*.{js,jsx,ts,tsx}',
10
+ '**/*.test.js',
11
+ '**/*.spec.js',
12
+ ],
7
13
  languageOptions: {
8
- globals: {
9
- ...globals.jest,
10
- },
14
+ globals: plugin.environments.globals.globals,
11
15
  },
12
16
  rules: {
13
17
  'jest/expect-expect': [
@@ -1,14 +1,16 @@
1
- import mdx from 'eslint-plugin-mdx';
1
+ import * as mdx from 'eslint-plugin-mdx';
2
2
 
3
3
  const plugin = {
4
4
  ...mdx.flat,
5
+ files: ['**/*.mdx'],
5
6
  processor: mdx.createRemarkProcessor({
6
7
  lintCodeBlocks: true,
7
8
  }),
8
9
  rules: {
9
10
  ...mdx.flat.rules,
10
- semi: 0,
11
- 'no-undef': 0,
11
+ semi: 'off',
12
+ 'no-undef': 'off',
13
+ 'no-unused-expressions': 'off',
12
14
  },
13
15
  };
14
16
 
package/src/react.js ADDED
@@ -0,0 +1,42 @@
1
+ import react from 'eslint-plugin-react';
2
+
3
+ export default {
4
+ files: ['**/*.{js,jsx,ts,tsx}'],
5
+ plugins: {
6
+ react,
7
+ },
8
+ languageOptions: {
9
+ parserOptions: {
10
+ ecmaFeatures: {
11
+ jsx: true,
12
+ },
13
+ },
14
+ },
15
+ rules: {
16
+ ...react.configs['recommended'].rules,
17
+ ...react.configs['jsx-runtime'].rules,
18
+ 'no-console': 'warn',
19
+ 'react/prop-types': 'off',
20
+ 'react/display-name': 'off',
21
+ 'react/no-unescaped-entities': [
22
+ 'error',
23
+ {
24
+ forbid: [
25
+ {
26
+ char: '>',
27
+ alternatives: ['>'],
28
+ },
29
+ {
30
+ char: '<',
31
+ alternatives: ['&lt;'],
32
+ },
33
+ ],
34
+ },
35
+ ],
36
+ },
37
+ settings: {
38
+ react: {
39
+ version: 'detect',
40
+ },
41
+ },
42
+ };
@@ -2,7 +2,8 @@ import js from '@eslint/js';
2
2
  import globals from 'globals';
3
3
 
4
4
  export default {
5
- files: ['**/*.{js,jsx}'],
5
+ files: ['**/*.{js,jsx,ts,tsx}'],
6
+ ignores: ['node_modules/**/*', 'dist/**/*'],
6
7
  languageOptions: {
7
8
  ecmaVersion: 'latest',
8
9
  sourceType: 'module',
@@ -1,4 +1,4 @@
1
- import plugin from 'eslint-plugin-import';
1
+ import * as plugin from 'eslint-plugin-import';
2
2
 
3
3
  const { parserOptions, ...rest } = plugin.configs.recommended;
4
4
 
@@ -1,4 +1,4 @@
1
- import plugin from 'eslint-plugin-import';
1
+ import * as plugin from 'eslint-plugin-import';
2
2
 
3
3
  const { parserOptions, ...rest } = plugin.configs.recommended;
4
4
 
@@ -9,7 +9,15 @@ export default {
9
9
  import: plugin,
10
10
  },
11
11
  rules: {
12
- 'import/no-unresolved': 'warn',
12
+ 'import/no-unresolved': [
13
+ 'warn',
14
+ {
15
+ // package.json "style" may be used here which
16
+ // will resolve for webpack but not within the
17
+ // eslint plugin
18
+ ignore: ['\\.css$'],
19
+ },
20
+ ],
13
21
  'import/no-named-as-default-member': 'off',
14
22
  'import/order': [
15
23
  'warn',
@@ -48,6 +56,16 @@ export default {
48
56
  group: 'internal',
49
57
  position: 'after',
50
58
  },
59
+ {
60
+ pattern: 'assets',
61
+ group: 'sibling',
62
+ position: 'after',
63
+ },
64
+ {
65
+ pattern: 'assets/**',
66
+ group: 'sibling',
67
+ position: 'after',
68
+ },
51
69
  ],
52
70
  groups: [
53
71
  'builtin',
@@ -63,6 +81,13 @@ export default {
63
81
  ],
64
82
  },
65
83
  settings: {
66
- 'import/resolver': 'webpack',
84
+ 'import/resolver': {
85
+ webpack: {
86
+ config: 'webpack.config.js',
87
+ },
88
+ node: {
89
+ extensions: ['.mjs', '.js', '.jsx', '.json'],
90
+ },
91
+ },
67
92
  },
68
93
  };
package/react.js DELETED
@@ -1,32 +0,0 @@
1
- import react from 'eslint-plugin-react';
2
- import globals from 'globals';
3
-
4
- // This dependency can be removed when this lands:
5
- // https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
6
- import { fixupPluginRules } from '@eslint/compat';
7
-
8
- export default {
9
- files: ['**/*.{js,jsx}'],
10
- plugins: {
11
- react: fixupPluginRules(react),
12
- },
13
- languageOptions: {
14
- parserOptions: {
15
- ecmaFeatures: {
16
- jsx: true,
17
- },
18
- },
19
- globals: {
20
- ...globals.browser,
21
- },
22
- },
23
- rules: {
24
- ...react.configs['recommended'].rules,
25
- ...react.configs['jsx-runtime'].rules,
26
- },
27
- settings: {
28
- react: {
29
- version: 'detect',
30
- },
31
- },
32
- };
File without changes