@automattic/eslint-plugin-wpvip 0.13.1 → 1.0.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/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@automattic/eslint-plugin-wpvip",
3
- "version": "0.13.1",
3
+ "version": "1.0.0",
4
4
  "description": "ESLint plugin for internal WordPress VIP projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "check-types": "tsc -p tsconfig.check.json",
8
8
  "cmd:format": "prettier --ignore-path .gitignore '**/*.(js|json|jsx|md|ts|tsx|yml|yaml)'",
9
9
  "cmd:jest": "npm run link-plugin && jest",
10
- "cmd:lint": "npm run link-plugin && eslint --ext 'js,jsx,ts,tsx'",
10
+ "cmd:lint": "npm run link-plugin && eslint",
11
11
  "format": "npm run cmd:format -- --write",
12
12
  "format:check": "npm run cmd:format -- --check",
13
13
  "jest": "npm run cmd:jest",
@@ -15,7 +15,7 @@
15
15
  "link-plugin": "mkdir -p ./node_modules/@automattic; ln -fns $(pwd) ./node_modules/@automattic/eslint-plugin-wpvip",
16
16
  "lint": "npm run cmd:lint .",
17
17
  "lint:fix": "npm run cmd:lint . -- --fix",
18
- "test": "npm run jest"
18
+ "test": "NODE_OPTIONS=--experimental-vm-modules npm run jest"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -32,37 +32,36 @@
32
32
  },
33
33
  "homepage": "https://github.com/Automattic/eslint-config-wpvip#readme",
34
34
  "dependencies": {
35
- "@babel/eslint-parser": "7.24.7",
36
- "@rushstack/eslint-patch": "1.10.3",
37
- "@typescript-eslint/eslint-plugin": "7.15.0",
38
- "@typescript-eslint/parser": "7.15.0",
39
- "eslint-config-prettier": "8.7.0",
40
- "eslint-import-resolver-typescript": "3.6.1",
41
- "eslint-plugin-import": "2.29.1",
42
- "eslint-plugin-jest": "28.5.0",
43
- "eslint-plugin-jsdoc": "46.8.2",
44
- "eslint-plugin-json": "3.1.0",
45
- "eslint-plugin-jsx-a11y": "6.7.1",
46
- "eslint-plugin-prettier": "4.2.1",
47
- "eslint-plugin-promise": "6.1.1",
48
- "eslint-plugin-react": "7.33.2",
49
- "eslint-plugin-react-hooks": "4.6.0",
50
- "eslint-plugin-security": "1.7.1",
51
- "eslint-plugin-unused-imports": "3.2.0",
35
+ "@babel/eslint-parser": "~7.28.5",
36
+ "@typescript-eslint/parser": "~8.48.1",
37
+ "eslint-config-prettier": "^10.1.8",
38
+ "eslint-import-resolver-typescript": "4.4.4",
39
+ "eslint-plugin-import": "2.32.0",
40
+ "eslint-plugin-jest": "29.2.1",
41
+ "eslint-plugin-jsdoc": "61.4.1",
42
+ "eslint-plugin-json": "4.0.1",
43
+ "eslint-plugin-jsx-a11y": "6.10.2",
44
+ "eslint-plugin-prettier": "5.5.4",
45
+ "eslint-plugin-promise": "7.2.1",
46
+ "eslint-plugin-react": "7.37.5",
47
+ "eslint-plugin-react-hooks": "7.0.1",
48
+ "eslint-plugin-security": "3.0.1",
49
+ "eslint-plugin-unused-imports": "4.3.0",
52
50
  "find-package-json": "1.2.0",
53
- "globals": "13.23.0"
51
+ "globals": "16.5.0",
52
+ "typescript-eslint": "^8.48.1"
54
53
  },
55
54
  "peerDependencies": {
56
- "eslint": "^8.56.0"
55
+ "eslint": "^9.7.0"
57
56
  },
58
57
  "devDependencies": {
59
- "@tsconfig/node18": "18.2.2",
60
- "@types/eslint": "8.44.8",
61
- "@types/jest": "29.5.12",
62
- "eslint": "8.56.0",
58
+ "@tsconfig/node20": "^20.1.8",
59
+ "@types/eslint": "9.6.1",
60
+ "@types/jest": "29.5.14",
61
+ "eslint": "^9.39.1",
63
62
  "jest": "29.7.0",
64
- "prettier": "npm:wp-prettier@2.8.5",
65
- "ts-jest": "29.1.5",
66
- "typescript": "5.5.3"
63
+ "prettier": "npm:wp-prettier@3.0.3",
64
+ "ts-jest": "29.4.6",
65
+ "typescript": "5.9.3"
67
66
  }
68
67
  }
package/plugin.js ADDED
@@ -0,0 +1,12 @@
1
+ const rules = require( './rules' );
2
+
3
+ /** @type {import('eslint').ESLint.Plugin & { configs: Record<string, import('eslint').Linter.Config[]> }} */
4
+ const plugin = {
5
+ meta: {
6
+ name: '@automattic/wpvip',
7
+ },
8
+ configs: {},
9
+ rules,
10
+ };
11
+
12
+ module.exports = plugin;
@@ -5,7 +5,19 @@
5
5
  const nestJsControllerDecorators = [ 'Controller' ];
6
6
  const nestJsRouteDecorators = [ 'Get', 'Post', 'Put', 'Delete', 'Patch', 'Options', 'Head' ];
7
7
 
8
+ /** @type {import('eslint').Rule.RuleModule} */
8
9
  module.exports = {
10
+ meta: {
11
+ type: 'problem',
12
+ docs: {
13
+ description: 'Enforce route prefixes for Nest.js route decorators',
14
+ },
15
+ messages: {
16
+ controllerPrefix: '@Controller should not have route prefixes.',
17
+ decoratorSlash: `@{{ decoratorName }} should have a route starting with '/' and not ending with '/'.`,
18
+ },
19
+ schema: [],
20
+ },
9
21
  create( context ) {
10
22
  return {
11
23
  Decorator( node ) {
@@ -21,7 +33,7 @@ module.exports = {
21
33
  if ( argument && argument.type === 'Literal' && argument.value !== '' ) {
22
34
  context.report( {
23
35
  node,
24
- message: '@Controller should not have route prefixes.',
36
+ messageId: 'controllerPrefix',
25
37
  } );
26
38
  }
27
39
  return;
@@ -36,7 +48,8 @@ module.exports = {
36
48
  ) {
37
49
  context.report( {
38
50
  node,
39
- message: `@${ decoratorName } should have a route starting with '/' and not ending with '/'.`,
51
+ messageId: 'decoratorSlash',
52
+ data: { decoratorName },
40
53
  } );
41
54
  }
42
55
  }
@@ -7,7 +7,18 @@
7
7
  * https://www.npmjs.com/package/eslint-plugin-no-async-foreach
8
8
  */
9
9
 
10
+ /** @type {import('eslint').Rule.RuleModule} */
10
11
  module.exports = {
12
+ meta: {
13
+ type: 'problem',
14
+ docs: {
15
+ description: 'Avoid passing an async function to Array.prototype.forEach',
16
+ },
17
+ messages: {
18
+ avoidAsyncForEach: 'Avoid passing an async function to Array.prototype.forEach',
19
+ },
20
+ schema: [],
21
+ },
11
22
  create( context ) {
12
23
  return {
13
24
  ExpressionStatement( node ) {
@@ -21,7 +32,7 @@ module.exports = {
21
32
  } );
22
33
  if ( functionArguments ) {
23
34
  if ( functionArguments.async ) {
24
- context.report( node, 'Avoid passing an async function to Array.prototype.forEach' );
35
+ context.report( { node, messageId: 'avoidAsyncForEach' } );
25
36
  }
26
37
  }
27
38
  }
@@ -3,6 +3,7 @@
3
3
  * https://github.com/WordPress/gutenberg/blob/%40wordpress/eslint-plugin%4014.1.0/packages/eslint-plugin/rules/no-unguarded-get-range-at.js
4
4
  */
5
5
 
6
+ /** @type {import('eslint').Rule.RuleModule} */
6
7
  module.exports = {
7
8
  meta: {
8
9
  type: 'problem',
package/init.js DELETED
@@ -1 +0,0 @@
1
- require( '@rushstack/eslint-patch/modern-module-resolution' );