@adonisjs/eslint-plugin 2.0.0-beta.1 → 2.0.0-beta.3
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/build/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
rules: {
|
|
3
|
+
'prefer-lazy-controller-import': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferLazyControllerImport", [], {
|
|
4
|
+
description: string;
|
|
5
|
+
recommended: string;
|
|
6
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
'prefer-lazy-listener-import': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferLazyListenerImport", [], {
|
|
8
|
+
description: string;
|
|
9
|
+
recommended: string;
|
|
10
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
package/build/index.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// src/rules/prefer_lazy_listener_import.ts
|
|
2
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
3
|
+
|
|
4
|
+
// src/utils.ts
|
|
5
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
6
|
+
var createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
|
|
7
|
+
|
|
8
|
+
// src/rules/prefer_lazy_listener_import.ts
|
|
9
|
+
var prefer_lazy_listener_import_default = createEslintRule({
|
|
10
|
+
name: "prefer-lazy-listener-import",
|
|
11
|
+
defaultOptions: [],
|
|
12
|
+
meta: {
|
|
13
|
+
type: "problem",
|
|
14
|
+
fixable: "code",
|
|
15
|
+
docs: {
|
|
16
|
+
description: "(Needed for HMR) Prefer lazy listener import over standard import",
|
|
17
|
+
recommended: "recommended"
|
|
18
|
+
},
|
|
19
|
+
schema: [],
|
|
20
|
+
messages: {
|
|
21
|
+
preferLazyListenerImport: "Replace standard import with lazy listener import"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
create: function(context) {
|
|
25
|
+
const importNodes = {};
|
|
26
|
+
const importIdentifiers = [];
|
|
27
|
+
let emitterIdentifier = "";
|
|
28
|
+
function isEmitterOnCallExpression(node, routerIdentifier) {
|
|
29
|
+
return node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.object.type === AST_NODE_TYPES.Identifier && node.callee.object.name === routerIdentifier && node.callee.property.type === AST_NODE_TYPES.Identifier && node.callee.property.name === "on";
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
/**
|
|
33
|
+
* Track all imported identifiers
|
|
34
|
+
* Also get the local name of the emitter import
|
|
35
|
+
*/
|
|
36
|
+
ImportDeclaration(node) {
|
|
37
|
+
for (const specifier of node.specifiers) {
|
|
38
|
+
if (specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportSpecifier") {
|
|
39
|
+
importIdentifiers.push(specifier.local.name);
|
|
40
|
+
importNodes[specifier.local.name] = node;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (node.source.value === "@adonisjs/core/services/emitter") {
|
|
44
|
+
if (node.specifiers[0] && node.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
45
|
+
emitterIdentifier = node.specifiers[0].local.name;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
CallExpression(node) {
|
|
50
|
+
if (!isEmitterOnCallExpression(node, emitterIdentifier)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const secondArgument = node.arguments[1];
|
|
54
|
+
if (secondArgument.type !== AST_NODE_TYPES.ArrayExpression) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const element of secondArgument.elements) {
|
|
58
|
+
if (!element) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (element.type !== "Identifier" || !importIdentifiers.includes(element.name)) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
context.report({
|
|
65
|
+
node: importNodes[element.name],
|
|
66
|
+
messageId: "preferLazyListenerImport",
|
|
67
|
+
fix(fixer) {
|
|
68
|
+
const importPath = importNodes[element.name].source.raw;
|
|
69
|
+
const newImportDeclaration = `const ${element.name} = () => import(${importPath})`;
|
|
70
|
+
return fixer.replaceText(importNodes[element.name], newImportDeclaration);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// src/rules/prefer_lazy_controller_import.ts
|
|
80
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
|
|
81
|
+
var HTTP_METHODS = ["get", "post", "put", "delete", "patch"];
|
|
82
|
+
var prefer_lazy_controller_import_default = createEslintRule({
|
|
83
|
+
name: "prefer-lazy-controller-import",
|
|
84
|
+
defaultOptions: [],
|
|
85
|
+
meta: {
|
|
86
|
+
type: "problem",
|
|
87
|
+
fixable: "code",
|
|
88
|
+
docs: {
|
|
89
|
+
description: "(Needed for HMR) Prefer lazy controller import over standard import",
|
|
90
|
+
recommended: "recommended"
|
|
91
|
+
},
|
|
92
|
+
schema: [],
|
|
93
|
+
messages: {
|
|
94
|
+
preferLazyControllerImport: "Replace standard import with lazy controller import"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
create: function(context) {
|
|
98
|
+
const importNodes = {};
|
|
99
|
+
const importIdentifiers = [];
|
|
100
|
+
let routerIdentifier = "";
|
|
101
|
+
function isRouteCallExpression(node, identifier) {
|
|
102
|
+
return node.callee.type === AST_NODE_TYPES2.MemberExpression && node.callee.object.type === AST_NODE_TYPES2.Identifier && node.callee.object.name === identifier && node.callee.property.type === AST_NODE_TYPES2.Identifier && HTTP_METHODS.includes(node.callee.property.name);
|
|
103
|
+
}
|
|
104
|
+
function isRouteResourceCallExpression(node, identifier) {
|
|
105
|
+
return node.callee.type === AST_NODE_TYPES2.MemberExpression && node.callee.object.type === AST_NODE_TYPES2.Identifier && node.callee.object.name === identifier && node.callee.property.type === AST_NODE_TYPES2.Identifier && node.callee.property.name === "resource";
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
/**
|
|
109
|
+
* Track all imported identifiers
|
|
110
|
+
* Also get the local name of the router import
|
|
111
|
+
*/
|
|
112
|
+
ImportDeclaration(node) {
|
|
113
|
+
for (const specifier of node.specifiers) {
|
|
114
|
+
if (specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportSpecifier") {
|
|
115
|
+
importIdentifiers.push(specifier.local.name);
|
|
116
|
+
importNodes[specifier.local.name] = node;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (node.source.value === "@adonisjs/core/services/router") {
|
|
120
|
+
if (node.specifiers[0] && node.specifiers[0].type === "ImportDefaultSpecifier") {
|
|
121
|
+
routerIdentifier = node.specifiers[0].local.name;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
CallExpression(node) {
|
|
126
|
+
let controller = null;
|
|
127
|
+
if (isRouteCallExpression(node, routerIdentifier)) {
|
|
128
|
+
const secondArgument = node.arguments[1];
|
|
129
|
+
if (secondArgument.type === AST_NODE_TYPES2.ArrayExpression) {
|
|
130
|
+
controller = secondArgument.elements[0];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (isRouteResourceCallExpression(node, routerIdentifier)) {
|
|
134
|
+
controller = node.arguments[1];
|
|
135
|
+
}
|
|
136
|
+
if (!controller) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (controller.type !== "Identifier" || !importIdentifiers.includes(controller.name)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
context.report({
|
|
143
|
+
node: importNodes[controller.name],
|
|
144
|
+
messageId: "preferLazyControllerImport",
|
|
145
|
+
fix(fixer) {
|
|
146
|
+
const importPath = importNodes[controller.name].source.raw;
|
|
147
|
+
const newImportDeclaration = `const ${controller.name} = () => import(${importPath})`;
|
|
148
|
+
return fixer.replaceText(importNodes[controller.name], newImportDeclaration);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// index.ts
|
|
157
|
+
var eslint_plugin_adonisjs_default = {
|
|
158
|
+
rules: {
|
|
159
|
+
"prefer-lazy-controller-import": prefer_lazy_controller_import_default,
|
|
160
|
+
"prefer-lazy-listener-import": prefer_lazy_listener_import_default
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
export {
|
|
164
|
+
eslint_plugin_adonisjs_default as default
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rules/prefer_lazy_listener_import.ts","../src/utils.ts","../src/rules/prefer_lazy_controller_import.ts","../index.ts"],"sourcesContent":["/*\n * @adonisjs/eslint-plugin\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'\nimport { createEslintRule } from '../utils.js'\n\n/**\n * ESLint rule to force lazy listener imports\n */\nexport default createEslintRule({\n name: 'prefer-lazy-listener-import',\n defaultOptions: [],\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description: '(Needed for HMR) Prefer lazy listener import over standard import',\n recommended: 'recommended',\n },\n schema: [],\n messages: {\n preferLazyListenerImport: 'Replace standard import with lazy listener import',\n },\n },\n\n create: function (context) {\n const importNodes: Record<string, TSESTree.ImportDeclaration> = {}\n const importIdentifiers: string[] = []\n let emitterIdentifier: string = ''\n\n function isEmitterOnCallExpression(node: TSESTree.CallExpression, routerIdentifier: string) {\n return (\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n node.callee.object.name === routerIdentifier &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n node.callee.property.name === 'on'\n )\n }\n\n return {\n /**\n * Track all imported identifiers\n * Also get the local name of the emitter import\n */\n ImportDeclaration(node) {\n for (const specifier of node.specifiers) {\n if (specifier.type === 'ImportDefaultSpecifier' || specifier.type === 'ImportSpecifier') {\n importIdentifiers.push(specifier.local.name)\n importNodes[specifier.local.name] = node\n }\n }\n\n if (node.source.value === '@adonisjs/core/services/emitter') {\n if (node.specifiers[0] && node.specifiers[0].type === 'ImportDefaultSpecifier') {\n emitterIdentifier = node.specifiers[0].local.name\n }\n }\n },\n\n CallExpression(node) {\n /**\n * Check if we are calling emitter.on()\n */\n if (!isEmitterOnCallExpression(node, emitterIdentifier)) {\n return\n }\n\n /**\n * Ensure the second argument is an array\n */\n const secondArgument = node.arguments[1]\n if (secondArgument.type !== AST_NODE_TYPES.ArrayExpression) {\n return\n }\n\n for (const element of secondArgument.elements) {\n if (!element) {\n continue\n }\n\n /**\n * If we are dealing with an Identifier that was imported\n * through a standard import, then report it as an error\n */\n if (element.type !== 'Identifier' || !importIdentifiers.includes(element.name)) {\n continue\n }\n\n context.report({\n node: importNodes[element.name],\n messageId: 'preferLazyListenerImport',\n fix(fixer) {\n const importPath = importNodes[element.name].source.raw\n const newImportDeclaration = `const ${element.name} = () => import(${importPath})`\n return fixer.replaceText(importNodes[element.name], newImportDeclaration)\n },\n })\n }\n },\n }\n },\n})\n","/*\n * @adonisjs/eslint-plugin\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { ESLintUtils } from '@typescript-eslint/utils'\n\nexport const createEslintRule = ESLintUtils.RuleCreator<{\n description: string\n recommended: string\n}>((ruleName) => ruleName)\n","/*\n * @adonisjs/eslint-plugin\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'\nimport { createEslintRule } from '../utils.js'\n\nconst HTTP_METHODS = ['get', 'post', 'put', 'delete', 'patch']\n\n/**\n * ESLint rule to force lazy controller import\n */\nexport default createEslintRule({\n name: 'prefer-lazy-controller-import',\n defaultOptions: [],\n meta: {\n type: 'problem',\n fixable: 'code',\n docs: {\n description: '(Needed for HMR) Prefer lazy controller import over standard import',\n recommended: 'recommended',\n },\n schema: [],\n messages: {\n preferLazyControllerImport: 'Replace standard import with lazy controller import',\n },\n },\n\n create: function (context) {\n const importNodes: Record<string, TSESTree.ImportDeclaration> = {}\n const importIdentifiers: string[] = []\n let routerIdentifier: string = ''\n\n function isRouteCallExpression(node: TSESTree.CallExpression, identifier: string) {\n return (\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n node.callee.object.name === identifier &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n HTTP_METHODS.includes(node.callee.property.name)\n )\n }\n\n function isRouteResourceCallExpression(node: TSESTree.CallExpression, identifier: string) {\n return (\n node.callee.type === AST_NODE_TYPES.MemberExpression &&\n node.callee.object.type === AST_NODE_TYPES.Identifier &&\n node.callee.object.name === identifier &&\n node.callee.property.type === AST_NODE_TYPES.Identifier &&\n node.callee.property.name === 'resource'\n )\n }\n\n return {\n /**\n * Track all imported identifiers\n * Also get the local name of the router import\n */\n ImportDeclaration(node) {\n for (const specifier of node.specifiers) {\n if (specifier.type === 'ImportDefaultSpecifier' || specifier.type === 'ImportSpecifier') {\n importIdentifiers.push(specifier.local.name)\n importNodes[specifier.local.name] = node\n }\n }\n\n if (node.source.value === '@adonisjs/core/services/router') {\n if (node.specifiers[0] && node.specifiers[0].type === 'ImportDefaultSpecifier') {\n routerIdentifier = node.specifiers[0].local.name\n }\n }\n },\n\n CallExpression(node) {\n /**\n * Check if we are calling router.get() or any other http method\n * OR if we are calling router.resource that also takes a controller\n * as an argument\n *\n *\n * Then let's extract the controller identifier from the call expression\n *\n * In the case of router.get/post/put.. we have to extract\n * the first element from the array\n *\n * router.get(\"/\", [HomeController, 'index'])\n */\n let controller: TSESTree.CallExpressionArgument | null = null\n if (isRouteCallExpression(node, routerIdentifier)) {\n const secondArgument = node.arguments[1]\n if (secondArgument.type === AST_NODE_TYPES.ArrayExpression) {\n controller = secondArgument.elements[0]\n }\n }\n\n /**\n * In the case of router.resource, we just have to extract the first argument\n *\n * router.resource(\"foo\", UserController)\n */\n if (isRouteResourceCallExpression(node, routerIdentifier)) {\n controller = node.arguments[1]\n }\n\n /**\n * Unable to extract controller\n */\n if (!controller) {\n return\n }\n\n /**\n * If we are dealing with an Identifier that was imported\n * through a standard import, then report it as an error\n */\n if (controller.type !== 'Identifier' || !importIdentifiers.includes(controller.name)) {\n return\n }\n\n context.report({\n node: importNodes[controller.name],\n messageId: 'preferLazyControllerImport',\n fix(fixer) {\n const importPath = importNodes[controller.name].source.raw\n const newImportDeclaration = `const ${controller.name} = () => import(${importPath})`\n return fixer.replaceText(importNodes[controller.name], newImportDeclaration)\n },\n })\n },\n }\n },\n})\n","/*\n * @adonisjs/eslint-plugin\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport preferLazyListenerImport from './src/rules/prefer_lazy_listener_import.js'\nimport preferLazyControllerImport from './src/rules/prefer_lazy_controller_import.js'\n\nexport default {\n rules: {\n 'prefer-lazy-controller-import': preferLazyControllerImport,\n 'prefer-lazy-listener-import': preferLazyListenerImport,\n },\n}\n"],"mappings":";AASA,SAAS,sBAAgC;;;ACAzC,SAAS,mBAAmB;AAErB,IAAM,mBAAmB,YAAY,YAGzC,CAAC,aAAa,QAAQ;;;ADCzB,IAAO,sCAAQ,iBAAiB;AAAA,EAC9B,MAAM;AAAA,EACN,gBAAgB,CAAC;AAAA,EACjB,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA,MACJ,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,IACA,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A,EACb,OAAO;AAAA,IACL,iCAAiC;AAAA,IACjC,+BAA+B;AAAA,EACjC;AACF;","names":["AST_NODE_TYPES","AST_NODE_TYPES"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rule to force lazy controller import
|
|
3
|
+
*/
|
|
4
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferLazyControllerImport", [], {
|
|
5
|
+
description: string;
|
|
6
|
+
recommended: string;
|
|
7
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rule to force lazy listener imports
|
|
3
|
+
*/
|
|
4
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferLazyListenerImport", [], {
|
|
5
|
+
description: string;
|
|
6
|
+
recommended: string;
|
|
7
|
+
}, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
export declare const createEslintRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, {
|
|
3
|
+
description: string;
|
|
4
|
+
recommended: string;
|
|
5
|
+
}>>) => ESLintUtils.RuleModule<MessageIds, Options, {
|
|
6
|
+
description: string;
|
|
7
|
+
recommended: string;
|
|
8
|
+
}, ESLintUtils.RuleListener>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/eslint-plugin",
|
|
3
3
|
"description": "ESLint plugin to enforce AdonisJS app specific linting rules",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.3",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.6.0"
|
|
7
7
|
},
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
|
|
27
27
|
"build": "npm run compile",
|
|
28
28
|
"release": "release-it",
|
|
29
|
+
"version": "npm run build",
|
|
30
|
+
"prepublishOnly": "npm run build",
|
|
29
31
|
"quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps bin/test.ts"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|