eslint-plugin-lube 0.1.6 → 0.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/README.md +2 -1
- package/index.js +53 -1
- package/node-type.text +71 -0
- package/package.json +26 -27
- package/private.d.ts +106 -19
- package/rules/pretty-imports.js +110 -0
- package/rules/svelte-naming-convention.js +15 -14
- package/test/pretty-imports/check_exports.js +85 -0
- package/test/pretty-imports/check_imports.js +85 -0
- package/test/pretty-imports.js +19 -0
- package/test/svelte-naming-convention/case_by_identifier.js +5 -35
package/README.md
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
| Rule | Code | Test |
|
|
4
4
|
|---|---|---|
|
|
5
|
-
| svelte-naming-convention | [code](https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/rules/svelte-naming-convention.js) | [test](https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/test/svelte-naming-convention
|
|
5
|
+
| svelte-naming-convention | [code](https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/rules/svelte-naming-convention.js) | [test](https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/test/svelte-naming-convention) |
|
|
6
|
+
| pretty-imports | [code](https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/rules/pretty-imports.js) | [test](https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/test/pretty-imports) |
|
package/index.js
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @type {import("eslint").ESLint.Plugin & {
|
|
3
|
+
* configs: Record<string, import("eslint").ESLint.ConfigData|{}>
|
|
4
|
+
* }}
|
|
5
|
+
*/
|
|
6
|
+
module.exports = {
|
|
7
|
+
configs: {
|
|
8
|
+
recommended: {
|
|
9
|
+
extends: ["eslint:recommended"],
|
|
10
|
+
plugins: ["lube"],
|
|
11
|
+
rules: {
|
|
12
|
+
"arrow-spacing": "error",
|
|
13
|
+
"comma-spacing": "error",
|
|
14
|
+
"dot-location": ["error", "property"],
|
|
15
|
+
"for-direction": "error",
|
|
16
|
+
"getter-return": "error",
|
|
17
|
+
"indent": ["error", "tab"],
|
|
18
|
+
"keyword-spacing": ["error", {
|
|
19
|
+
"after": true,
|
|
20
|
+
"before": true
|
|
21
|
+
}],
|
|
22
|
+
"lube/svelte-naming-convention": "error",
|
|
23
|
+
"lube/pretty-imports": "error",
|
|
24
|
+
"max-len": ["warn", 120],
|
|
25
|
+
"max-nested-callbacks": ["error", 3],
|
|
26
|
+
"no-console": "warn",
|
|
27
|
+
"no-duplicate-imports": "error",
|
|
28
|
+
"no-empty-pattern": "error",
|
|
29
|
+
"no-multi-spaces": "error",
|
|
30
|
+
"object-curly-spacing": ["error", "always"],
|
|
31
|
+
"prefer-const": "warn",
|
|
32
|
+
"quotes": ["error", "double"],
|
|
33
|
+
"semi": ["error", "never"],
|
|
34
|
+
"semi-spacing": ["error", {
|
|
35
|
+
"after": true,
|
|
36
|
+
"before": false
|
|
37
|
+
}],
|
|
38
|
+
"space-before-function-paren": ["error", {
|
|
39
|
+
"anonymous": "never",
|
|
40
|
+
"asyncArrow": "always",
|
|
41
|
+
"named": "never"
|
|
42
|
+
}],
|
|
43
|
+
"space-in-parens": ["error", "never"],
|
|
44
|
+
"space-infix-ops": "error",
|
|
45
|
+
"space-unary-ops": "error"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
rules: {
|
|
50
|
+
"pretty-imports": require("./rules/pretty-imports"),
|
|
51
|
+
"svelte-naming-convention": require("./rules/svelte-naming-convention")
|
|
52
|
+
}
|
|
53
|
+
}
|
package/node-type.text
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* ArrayExpression */
|
|
2
|
+
/* ArrayPattern */
|
|
3
|
+
/* ArrowFunctionExpression */
|
|
4
|
+
/* AssignmentExpression */
|
|
5
|
+
/* AssignmentPattern */
|
|
6
|
+
/* AwaitExpression */
|
|
7
|
+
/* BinaryExpression */
|
|
8
|
+
/* BlockStatement */
|
|
9
|
+
/* BreakStatement */
|
|
10
|
+
/* CallExpression */
|
|
11
|
+
/* CatchClause */
|
|
12
|
+
/* ChainExpression */
|
|
13
|
+
/* ClassBody */
|
|
14
|
+
/* ClassDeclaration */
|
|
15
|
+
/* ClassExpression */
|
|
16
|
+
/* ConditionalExpression */
|
|
17
|
+
/* ContinueStatement */
|
|
18
|
+
/* DebuggerStatement */
|
|
19
|
+
/* DoWhileStatement */
|
|
20
|
+
/* EmptyStatement */
|
|
21
|
+
/* ExportAllDeclaration */
|
|
22
|
+
/* ExportDefaultDeclaration */
|
|
23
|
+
/* ExportNamedDeclaration */
|
|
24
|
+
/* ExportSpecifier */
|
|
25
|
+
/* ExpressionStatement */
|
|
26
|
+
/* ForInStatement */
|
|
27
|
+
/* ForOfStatement */
|
|
28
|
+
/* ForStatement */
|
|
29
|
+
/* FunctionDeclaration */
|
|
30
|
+
/* FunctionExpression */
|
|
31
|
+
/* Identifier */
|
|
32
|
+
/* IfStatement */
|
|
33
|
+
/* ImportDeclaration */
|
|
34
|
+
/* ImportDefaultSpecifier */
|
|
35
|
+
/* ImportExpression */
|
|
36
|
+
/* ImportNamespaceSpecifier */
|
|
37
|
+
/* ImportSpecifier */
|
|
38
|
+
/* LabeledStatement */
|
|
39
|
+
/* Literal */
|
|
40
|
+
/* LogicalExpression */
|
|
41
|
+
/* MemberExpression */
|
|
42
|
+
/* MetaProperty */
|
|
43
|
+
/* MethodDefinition */
|
|
44
|
+
/* NewExpression */
|
|
45
|
+
/* ObjectExpression */
|
|
46
|
+
/* ObjectPattern */
|
|
47
|
+
/* PrivateIdentifier */
|
|
48
|
+
/* Program */
|
|
49
|
+
/* Property */
|
|
50
|
+
/* PropertyDefinition */
|
|
51
|
+
/* RestElement */
|
|
52
|
+
/* ReturnStatement */
|
|
53
|
+
/* SequenceExpression */
|
|
54
|
+
/* SpreadElement */
|
|
55
|
+
/* StaticBlock */
|
|
56
|
+
/* Super */
|
|
57
|
+
/* SwitchCase */
|
|
58
|
+
/* SwitchStatement */
|
|
59
|
+
/* TaggedTemplateExpression */
|
|
60
|
+
/* TemplateElement */
|
|
61
|
+
/* TemplateLiteral */
|
|
62
|
+
/* ThisExpression */
|
|
63
|
+
/* ThrowStatement */
|
|
64
|
+
/* TryStatement */
|
|
65
|
+
/* UnaryExpression */
|
|
66
|
+
/* UpdateExpression */
|
|
67
|
+
/* VariableDeclaration */
|
|
68
|
+
/* VariableDeclarator */
|
|
69
|
+
/* WhileStatement */
|
|
70
|
+
/* WithStatement */
|
|
71
|
+
/* YieldExpression */
|
package/package.json
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "artxe2",
|
|
3
|
-
"bugs": {
|
|
4
|
-
"url": "https://github.com/Artxe2/lube-series/issues"
|
|
5
|
-
},
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"author": "artxe2",
|
|
3
|
+
"bugs": {
|
|
4
|
+
"url": "https://github.com/Artxe2/lube-series/issues"
|
|
5
|
+
},
|
|
6
|
+
"description": "Eslint rules expand options",
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@types/eslint": "^8.44.2",
|
|
9
|
+
"@types/estree": "^1.0.1",
|
|
10
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
11
|
+
"eslint": "^8.47.0",
|
|
12
|
+
"mocha": "^10.2.0"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"name": "eslint-plugin-lube",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/Artxe2/lube-series",
|
|
19
|
+
"directory": "packages/eslint-plugin-lube"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "mocha"
|
|
23
|
+
},
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"version": "0.2.0"
|
|
26
|
+
}
|
package/private.d.ts
CHANGED
|
@@ -1,22 +1,109 @@
|
|
|
1
|
-
import
|
|
2
|
-
Node,
|
|
3
|
-
Pattern
|
|
4
|
-
} from "estree"
|
|
1
|
+
import * as estree from "estree"
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
computed: boolean
|
|
8
|
-
id: ASTNode
|
|
9
|
-
imported: ASTNode
|
|
10
|
-
key: ASTNode
|
|
11
|
-
left: ASTNode
|
|
12
|
-
local: ASTNode
|
|
13
|
-
name: string
|
|
14
|
-
object: ASTNode
|
|
3
|
+
export type ASTNode = {
|
|
15
4
|
parent: ASTNode
|
|
16
|
-
property: ASTNode
|
|
17
5
|
range: [number, number]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
} & (
|
|
7
|
+
estree.ArrayExpression & {
|
|
8
|
+
elements: ASTNode[]
|
|
9
|
+
}
|
|
10
|
+
| estree.ArrayPattern & {
|
|
11
|
+
elements: ASTNode[]
|
|
12
|
+
}
|
|
13
|
+
| estree.ArrowFunctionExpression & {
|
|
14
|
+
body: ASTNode
|
|
15
|
+
params: ASTNode[]
|
|
16
|
+
}
|
|
17
|
+
| estree.AssignmentExpression
|
|
18
|
+
| estree.AssignmentPattern
|
|
19
|
+
| estree.AwaitExpression
|
|
20
|
+
| estree.BinaryExpression
|
|
21
|
+
| estree.BlockStatement
|
|
22
|
+
| estree.BreakStatement
|
|
23
|
+
| estree.CallExpression
|
|
24
|
+
| estree.CatchClause
|
|
25
|
+
| estree.ChainExpression
|
|
26
|
+
| estree.ClassBody
|
|
27
|
+
| estree.ClassDeclaration
|
|
28
|
+
| estree.ClassExpression
|
|
29
|
+
| estree.ConditionalExpression
|
|
30
|
+
| estree.ContinueStatement
|
|
31
|
+
| estree.DebuggerStatement
|
|
32
|
+
| estree.DoWhileStatement
|
|
33
|
+
| estree.EmptyStatement
|
|
34
|
+
| estree.ExportAllDeclaration
|
|
35
|
+
| estree.ExportDefaultDeclaration
|
|
36
|
+
| estree.ExportNamedDeclaration & {
|
|
37
|
+
source: estree.SimpleLiteral & {
|
|
38
|
+
range: [number, number]
|
|
39
|
+
raw: string
|
|
40
|
+
value: string
|
|
41
|
+
}
|
|
42
|
+
specifiers: ASTNode[]
|
|
43
|
+
}
|
|
44
|
+
| estree.ExportSpecifier
|
|
45
|
+
| estree.ExpressionStatement
|
|
46
|
+
| estree.ForInStatement
|
|
47
|
+
| estree.ForOfStatement
|
|
48
|
+
| estree.ForStatement
|
|
49
|
+
| estree.FunctionDeclaration & {
|
|
50
|
+
body: ASTNode
|
|
51
|
+
params: ASTNode[]
|
|
52
|
+
}
|
|
53
|
+
| estree.FunctionExpression & {
|
|
54
|
+
body: ASTNode
|
|
55
|
+
params: ASTNode[]
|
|
56
|
+
}
|
|
57
|
+
| estree.Identifier
|
|
58
|
+
| estree.IfStatement
|
|
59
|
+
| estree.ImportDeclaration & {
|
|
60
|
+
source: estree.SimpleLiteral & {
|
|
61
|
+
range: [number, number]
|
|
62
|
+
raw: string
|
|
63
|
+
value: string
|
|
64
|
+
}
|
|
65
|
+
specifiers: ASTNode[]
|
|
66
|
+
}
|
|
67
|
+
| estree.ImportDefaultSpecifier
|
|
68
|
+
| estree.ImportExpression
|
|
69
|
+
| estree.ImportNamespaceSpecifier
|
|
70
|
+
| estree.ImportSpecifier
|
|
71
|
+
| estree.LabeledStatement
|
|
72
|
+
| estree.Literal
|
|
73
|
+
| estree.LogicalExpression
|
|
74
|
+
| estree.MemberExpression
|
|
75
|
+
| estree.MetaProperty
|
|
76
|
+
| estree.MethodDefinition
|
|
77
|
+
| estree.NewExpression
|
|
78
|
+
| estree.ObjectExpression & {
|
|
79
|
+
properties: ASTNode[]
|
|
80
|
+
}
|
|
81
|
+
| estree.ObjectPattern & {
|
|
82
|
+
properties: ASTNode[]
|
|
83
|
+
}
|
|
84
|
+
| estree.PrivateIdentifier
|
|
85
|
+
| estree.Program
|
|
86
|
+
| estree.Property & { key: estree.Identifier }
|
|
87
|
+
| estree.PropertyDefinition
|
|
88
|
+
| estree.RestElement
|
|
89
|
+
| estree.ReturnStatement
|
|
90
|
+
| estree.SequenceExpression
|
|
91
|
+
| estree.SpreadElement
|
|
92
|
+
| estree.StaticBlock
|
|
93
|
+
| estree.Super
|
|
94
|
+
| estree.SwitchCase
|
|
95
|
+
| estree.SwitchStatement
|
|
96
|
+
| estree.TaggedTemplateExpression
|
|
97
|
+
| estree.TemplateElement
|
|
98
|
+
| estree.TemplateLiteral
|
|
99
|
+
| estree.ThisExpression
|
|
100
|
+
| estree.ThrowStatement
|
|
101
|
+
| estree.TryStatement
|
|
102
|
+
| estree.UnaryExpression
|
|
103
|
+
| estree.UpdateExpression
|
|
104
|
+
| estree.VariableDeclaration
|
|
105
|
+
| estree.VariableDeclarator
|
|
106
|
+
| estree.WhileStatement
|
|
107
|
+
| estree.WithStatement
|
|
108
|
+
| estree.YieldExpression
|
|
109
|
+
)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
/** @type {import("eslint").Rule.RuleModule} */
|
|
3
|
+
module.exports = {
|
|
4
|
+
meta: {
|
|
5
|
+
docs: {
|
|
6
|
+
description: "Enforces pretty imports.",
|
|
7
|
+
recommended: true,
|
|
8
|
+
url: "https://github.com/Artxe2/lube-series/blob/master/packages/eslint-plugin-lube/test/pretty-imports"
|
|
9
|
+
},
|
|
10
|
+
fixable: "code",
|
|
11
|
+
messages: {
|
|
12
|
+
not_match: "This imports is not pretty"
|
|
13
|
+
},
|
|
14
|
+
schema: [{
|
|
15
|
+
properties: {
|
|
16
|
+
checkExports: {
|
|
17
|
+
type: "boolean",
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
checkImports: {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
default: true
|
|
23
|
+
},
|
|
24
|
+
indent: {
|
|
25
|
+
type: "string",
|
|
26
|
+
default: "\t"
|
|
27
|
+
},
|
|
28
|
+
maxLength: {
|
|
29
|
+
type: "number",
|
|
30
|
+
default: 30
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
type: "object"
|
|
34
|
+
}],
|
|
35
|
+
type: "suggestion"
|
|
36
|
+
},
|
|
37
|
+
create(context) {
|
|
38
|
+
const check_exports = /** @type {boolean} */ (context.options[0]?.checkExports) ?? true
|
|
39
|
+
const check_imports = /** @type {boolean} */ (context.options[0]?.checkImports) ?? true
|
|
40
|
+
const indent = /** @type {string} */ (context.options[0]?.indent) ?? "\t"
|
|
41
|
+
const max_length = /** @type {number} */ (context.options[0]?.maxLength) ?? 30
|
|
42
|
+
const source_code = context.sourceCode
|
|
43
|
+
const text = source_code.text
|
|
44
|
+
|
|
45
|
+
const indent_regex = /[ \t]*(?=[^\n]*$)/
|
|
46
|
+
/** @param {number} index */
|
|
47
|
+
function get_indent(index) {
|
|
48
|
+
return text.slice(0, index).match(indent_regex)?.[0] || ""
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {import("../private").ASTNode} node
|
|
53
|
+
* @param {string} corrected_text
|
|
54
|
+
*/
|
|
55
|
+
function report(node, corrected_text) {
|
|
56
|
+
context.report({
|
|
57
|
+
fix(fixer) {
|
|
58
|
+
return fixer.replaceText(node, corrected_text)
|
|
59
|
+
},
|
|
60
|
+
messageId: "not_match",
|
|
61
|
+
node: /** @type {import("estree").Node} */(node)
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
/** @param {import("../private").ASTNode & import("estree").ExportNamedDeclaration} node */
|
|
67
|
+
ExportNamedDeclaration(node) {
|
|
68
|
+
if (check_exports && node.specifiers[0]?.type == "ExportSpecifier") {
|
|
69
|
+
const line_indent = get_indent(node.range[0])
|
|
70
|
+
let length = 0
|
|
71
|
+
for (const s of node.specifiers) {
|
|
72
|
+
length += s.range[1] - s.range[0]
|
|
73
|
+
}
|
|
74
|
+
const corrected_text = length > max_length
|
|
75
|
+
? `export {\n${line_indent + indent}${
|
|
76
|
+
/** @type {import("../private").ASTNode[]} v */
|
|
77
|
+
(node.specifiers).map(v => text.slice(v.range[0], v.range[1]))
|
|
78
|
+
.join(",\n" + line_indent + indent)
|
|
79
|
+
}\n${line_indent}} from ${text.slice(node.source.range[0], node.range[1])}`
|
|
80
|
+
: `export { ${
|
|
81
|
+
/** @type {import("../private").ASTNode[]} v */
|
|
82
|
+
(node.specifiers).map(v => text.slice(v.range[0], v.range[1])).join(", ")
|
|
83
|
+
} } from ${text.slice(node.source.range[0], node.range[1])}`
|
|
84
|
+
if (corrected_text != text.slice(node.range[0], node.range[1])) report(node, corrected_text)
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
/** @param {import("../private").ASTNode & import("estree").ImportDeclaration} node */
|
|
88
|
+
ImportDeclaration(node) {
|
|
89
|
+
if (check_imports && node.specifiers[0]?.type == "ImportSpecifier") {
|
|
90
|
+
const line_indent = get_indent(node.range[0])
|
|
91
|
+
let length = 0
|
|
92
|
+
for (const s of node.specifiers) {
|
|
93
|
+
length += s.range[1] - s.range[0]
|
|
94
|
+
}
|
|
95
|
+
const corrected_text = length > max_length
|
|
96
|
+
? `import {\n${line_indent + indent}${
|
|
97
|
+
/** @type {import("../private").ASTNode[]} v */
|
|
98
|
+
(node.specifiers).map(v => text.slice(v.range[0], v.range[1]))
|
|
99
|
+
.join(",\n" + line_indent + indent)
|
|
100
|
+
}\n${line_indent}} from ${text.slice(node.source.range[0], node.range[1])}`
|
|
101
|
+
: `import { ${
|
|
102
|
+
/** @type {import("../private").ASTNode[]} v */
|
|
103
|
+
(node.specifiers).map(v => text.slice(v.range[0], v.range[1])).join(", ")
|
|
104
|
+
} } from ${text.slice(node.source.range[0], node.range[1])}`
|
|
105
|
+
if (corrected_text != text.slice(node.range[0], node.range[1])) report(node, corrected_text)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
|
15
15
|
properties: {
|
|
16
16
|
fixSameNames: {
|
|
17
17
|
type: "boolean",
|
|
18
|
-
default:
|
|
18
|
+
default: true
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
type: "object"
|
|
@@ -23,13 +23,13 @@ module.exports = {
|
|
|
23
23
|
type: "suggestion"
|
|
24
24
|
},
|
|
25
25
|
create(context) {
|
|
26
|
-
const fix_same_names = /** @type {boolean} */ (context.options[0]?.fixSameNames)
|
|
26
|
+
const fix_same_names = /** @type {boolean} */ (context.options[0]?.fixSameNames) ?? true
|
|
27
27
|
|
|
28
28
|
// let name | const name | class name
|
|
29
|
-
const allow_regex = /^[_$]?[_$]?(?:[
|
|
30
|
-
const fixable_name_regex = /^[_$]?[_$]?(?:[
|
|
31
|
-
const fix_regex = /([
|
|
32
|
-
const camel_case_regex = /^[
|
|
29
|
+
const allow_regex = /^[_$]?[_$]?(?:[\da-z]+(?:_[\da-z]+)*\$?\$?)?$|^[A-Z][\dA-Z_]*$|^(?:[\dA-Z][\da-z]*)+$/
|
|
30
|
+
const fixable_name_regex = /^[_$]?[_$]?(?:[\dA-Za-z]+(?:_[\dA-Za-z]+)*\$?\$?)?$/
|
|
31
|
+
const fix_regex = /([\da-z]?)([A-Z][\dA-Z]*)/g
|
|
32
|
+
const camel_case_regex = /^[\da-z]+([A-Z][\da-z]*)*$/
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* @param {string} _
|
|
@@ -47,7 +47,7 @@ module.exports = {
|
|
|
47
47
|
/** @type {Set<import("../private").ASTNode>} */
|
|
48
48
|
const shortand_properties = new Set()
|
|
49
49
|
|
|
50
|
-
/** @param {import("../private").ASTNode} node */
|
|
50
|
+
/** @param {import("../private").ASTNode & import("estree").Identifier} node */
|
|
51
51
|
function defer(node) {
|
|
52
52
|
if (fix_same_names) {
|
|
53
53
|
const name = node.name
|
|
@@ -63,7 +63,7 @@ module.exports = {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/** @param {import("../private").ASTNode} node */
|
|
66
|
+
/** @param {import("../private").ASTNode & import("estree").Identifier} node */
|
|
67
67
|
function report(node) {
|
|
68
68
|
const name = node.name
|
|
69
69
|
context.report({
|
|
@@ -78,15 +78,13 @@ module.exports = {
|
|
|
78
78
|
}
|
|
79
79
|
return null
|
|
80
80
|
},
|
|
81
|
-
messageId:
|
|
82
|
-
? "not_match_private"
|
|
83
|
-
: "not_match",
|
|
81
|
+
messageId: "not_match",
|
|
84
82
|
node: /** @type {import("estree").Node} */(node)
|
|
85
83
|
})
|
|
86
84
|
if (fix_same_names) {
|
|
87
85
|
const usages = pending_usages.get(name)
|
|
88
86
|
while (usages?.length) {
|
|
89
|
-
report(/** @type {import("../private").ASTNode} */(
|
|
87
|
+
report(/** @type {import("../private").ASTNode & import("estree").Identifier} */(
|
|
90
88
|
usages.pop()
|
|
91
89
|
))
|
|
92
90
|
}
|
|
@@ -95,7 +93,7 @@ module.exports = {
|
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
return {
|
|
98
|
-
/** @param {import("../private").ASTNode} node */
|
|
96
|
+
/** @param {import("../private").ASTNode & import("estree").Identifier} node */
|
|
99
97
|
Identifier(node) {
|
|
100
98
|
const name = node.name
|
|
101
99
|
if (allow_regex.test(name)) return
|
|
@@ -124,7 +122,10 @@ module.exports = {
|
|
|
124
122
|
// (left = right) => {}
|
|
125
123
|
if ("AssignmentPattern" == type) {
|
|
126
124
|
if (parent.left == node) {
|
|
127
|
-
|
|
125
|
+
// function func({ camelCase = true }) {}
|
|
126
|
+
if (parent.parent?.type != "Property") {
|
|
127
|
+
report(node)
|
|
128
|
+
}
|
|
128
129
|
} else {
|
|
129
130
|
defer(node)
|
|
130
131
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("eslint").RuleTester.ValidTestCase[]} valid
|
|
3
|
+
* @param {import("eslint").RuleTester.InvalidTestCase[]} invalid
|
|
4
|
+
*/
|
|
5
|
+
exports.module = (valid, invalid) => {
|
|
6
|
+
valid.push({
|
|
7
|
+
code: `
|
|
8
|
+
|
|
9
|
+
export { a, b as c, d } from 'module' ;
|
|
10
|
+
export { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
|
|
11
|
+
`,
|
|
12
|
+
options: [{ maxLength: 30 }],
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: "latest",
|
|
15
|
+
sourceType: "module"
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
invalid.push(
|
|
19
|
+
{
|
|
20
|
+
code: `
|
|
21
|
+
|
|
22
|
+
export { a, b as c, d } from 'module' ;
|
|
23
|
+
export { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
|
|
24
|
+
`,
|
|
25
|
+
errors: [{
|
|
26
|
+
messageId: "not_match",
|
|
27
|
+
type: "ExportNamedDeclaration",
|
|
28
|
+
line: 4,
|
|
29
|
+
column: 7
|
|
30
|
+
}],
|
|
31
|
+
options: [{ maxLength: 10 }],
|
|
32
|
+
output: `
|
|
33
|
+
|
|
34
|
+
export { a, b as c, d } from 'module' ;
|
|
35
|
+
export {
|
|
36
|
+
fff,
|
|
37
|
+
ggg,
|
|
38
|
+
hhh,
|
|
39
|
+
iii,
|
|
40
|
+
jjj,
|
|
41
|
+
kkk,
|
|
42
|
+
lll
|
|
43
|
+
} from 'module/2'
|
|
44
|
+
`,
|
|
45
|
+
parserOptions: {
|
|
46
|
+
ecmaVersion: "latest",
|
|
47
|
+
sourceType: "module"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
code: `
|
|
52
|
+
|
|
53
|
+
export { a, b as c, d } from 'module' ;
|
|
54
|
+
export { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
|
|
55
|
+
`,
|
|
56
|
+
errors: [{
|
|
57
|
+
messageId: "not_match",
|
|
58
|
+
type: "ExportNamedDeclaration",
|
|
59
|
+
line: 4,
|
|
60
|
+
column: 7
|
|
61
|
+
}],
|
|
62
|
+
options: [{
|
|
63
|
+
indent: " ",
|
|
64
|
+
maxLength: 10
|
|
65
|
+
}],
|
|
66
|
+
output: `
|
|
67
|
+
|
|
68
|
+
export { a, b as c, d } from 'module' ;
|
|
69
|
+
export {
|
|
70
|
+
fff,
|
|
71
|
+
ggg,
|
|
72
|
+
hhh,
|
|
73
|
+
iii,
|
|
74
|
+
jjj,
|
|
75
|
+
kkk,
|
|
76
|
+
lll
|
|
77
|
+
} from 'module/2'
|
|
78
|
+
`,
|
|
79
|
+
parserOptions: {
|
|
80
|
+
ecmaVersion: "latest",
|
|
81
|
+
sourceType: "module"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import("eslint").RuleTester.ValidTestCase[]} valid
|
|
3
|
+
* @param {import("eslint").RuleTester.InvalidTestCase[]} invalid
|
|
4
|
+
*/
|
|
5
|
+
exports.module = (valid, invalid) => {
|
|
6
|
+
valid.push({
|
|
7
|
+
code: `
|
|
8
|
+
|
|
9
|
+
import { a, b as c, d } from 'module' ;
|
|
10
|
+
import { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
|
|
11
|
+
`,
|
|
12
|
+
options: [{ maxLength: 30 }],
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: "latest",
|
|
15
|
+
sourceType: "module"
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
invalid.push(
|
|
19
|
+
{
|
|
20
|
+
code: `
|
|
21
|
+
|
|
22
|
+
import { a, b as c, d } from 'module' ;
|
|
23
|
+
import { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
|
|
24
|
+
`,
|
|
25
|
+
errors: [{
|
|
26
|
+
messageId: "not_match",
|
|
27
|
+
type: "ImportDeclaration",
|
|
28
|
+
line: 4,
|
|
29
|
+
column: 7
|
|
30
|
+
}],
|
|
31
|
+
options: [{ maxLength: 10 }],
|
|
32
|
+
output: `
|
|
33
|
+
|
|
34
|
+
import { a, b as c, d } from 'module' ;
|
|
35
|
+
import {
|
|
36
|
+
fff,
|
|
37
|
+
ggg,
|
|
38
|
+
hhh,
|
|
39
|
+
iii,
|
|
40
|
+
jjj,
|
|
41
|
+
kkk,
|
|
42
|
+
lll
|
|
43
|
+
} from 'module/2'
|
|
44
|
+
`,
|
|
45
|
+
parserOptions: {
|
|
46
|
+
ecmaVersion: "latest",
|
|
47
|
+
sourceType: "module"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
code: `
|
|
52
|
+
|
|
53
|
+
import { a, b as c, d } from 'module' ;
|
|
54
|
+
import { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
|
|
55
|
+
`,
|
|
56
|
+
errors: [{
|
|
57
|
+
messageId: "not_match",
|
|
58
|
+
type: "ImportDeclaration",
|
|
59
|
+
line: 4,
|
|
60
|
+
column: 7
|
|
61
|
+
}],
|
|
62
|
+
options: [{
|
|
63
|
+
indent: " ",
|
|
64
|
+
maxLength: 10
|
|
65
|
+
}],
|
|
66
|
+
output: `
|
|
67
|
+
|
|
68
|
+
import { a, b as c, d } from 'module' ;
|
|
69
|
+
import {
|
|
70
|
+
fff,
|
|
71
|
+
ggg,
|
|
72
|
+
hhh,
|
|
73
|
+
iii,
|
|
74
|
+
jjj,
|
|
75
|
+
kkk,
|
|
76
|
+
lll
|
|
77
|
+
} from 'module/2'
|
|
78
|
+
`,
|
|
79
|
+
parserOptions: {
|
|
80
|
+
ecmaVersion: "latest",
|
|
81
|
+
sourceType: "module"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
const { RuleTester } = require("eslint")
|
|
3
|
+
|
|
4
|
+
/** @type {RuleTester.ValidTestCase[]} */
|
|
5
|
+
const valid = []
|
|
6
|
+
/** @type {RuleTester.InvalidTestCase[]} */
|
|
7
|
+
const invalid = []
|
|
8
|
+
|
|
9
|
+
require("./pretty-imports/check_exports").module(valid, invalid)
|
|
10
|
+
require("./pretty-imports/check_imports").module(valid, invalid)
|
|
11
|
+
|
|
12
|
+
new RuleTester().run(
|
|
13
|
+
"pretty-imports",
|
|
14
|
+
require("../rules/pretty-imports"),
|
|
15
|
+
{
|
|
16
|
+
valid,
|
|
17
|
+
invalid
|
|
18
|
+
}
|
|
19
|
+
)
|
|
@@ -33,7 +33,6 @@ exports.module = (valid, invalid) => {
|
|
|
33
33
|
column: 18
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
-
options: [{ fixSameNames: true }],
|
|
37
36
|
output: `
|
|
38
37
|
var value = [ deferA ]
|
|
39
38
|
var value = [ pending_a ]
|
|
@@ -70,6 +69,7 @@ exports.module = (valid, invalid) => {
|
|
|
70
69
|
pendingA = pendingB
|
|
71
70
|
var pendingA, pendingB
|
|
72
71
|
pendingA = pendingB
|
|
72
|
+
function func({ pendingA = 123 }) {}
|
|
73
73
|
`,
|
|
74
74
|
errors: [
|
|
75
75
|
{
|
|
@@ -103,13 +103,14 @@ exports.module = (valid, invalid) => {
|
|
|
103
103
|
column: 15
|
|
104
104
|
}
|
|
105
105
|
],
|
|
106
|
-
options: [{ fixSameNames: true }],
|
|
107
106
|
output: `
|
|
108
107
|
deferA = deferB
|
|
109
108
|
pending_a = pending_b
|
|
110
109
|
var pending_a, pending_b
|
|
111
110
|
pending_a = pending_b
|
|
112
|
-
|
|
111
|
+
function func({ pendingA = 123 }) {}
|
|
112
|
+
`,
|
|
113
|
+
parserOptions: { ecmaVersion: "latest" }
|
|
113
114
|
},
|
|
114
115
|
// AssignmentPattern
|
|
115
116
|
{
|
|
@@ -141,7 +142,6 @@ exports.module = (valid, invalid) => {
|
|
|
141
142
|
column: 18
|
|
142
143
|
}
|
|
143
144
|
],
|
|
144
|
-
options: [{ fixSameNames: true }],
|
|
145
145
|
output: `
|
|
146
146
|
(camel_case = deferA) => {}
|
|
147
147
|
(snake_case = pending_a) => {}
|
|
@@ -175,7 +175,6 @@ exports.module = (valid, invalid) => {
|
|
|
175
175
|
column: 10
|
|
176
176
|
}
|
|
177
177
|
],
|
|
178
|
-
options: [{ fixSameNames: true }],
|
|
179
178
|
output: `
|
|
180
179
|
await deferA
|
|
181
180
|
await pending_a
|
|
@@ -227,7 +226,6 @@ exports.module = (valid, invalid) => {
|
|
|
227
226
|
column: 15
|
|
228
227
|
}
|
|
229
228
|
],
|
|
230
|
-
options: [{ fixSameNames: true }],
|
|
231
229
|
output: `
|
|
232
230
|
deferA = deferB
|
|
233
231
|
pending_a - pending_b
|
|
@@ -260,7 +258,6 @@ exports.module = (valid, invalid) => {
|
|
|
260
258
|
column: 4
|
|
261
259
|
}
|
|
262
260
|
],
|
|
263
|
-
options: [{ fixSameNames: true }],
|
|
264
261
|
output: `
|
|
265
262
|
deferA()
|
|
266
263
|
pending_a()
|
|
@@ -319,7 +316,6 @@ exports.module = (valid, invalid) => {
|
|
|
319
316
|
column: 22
|
|
320
317
|
}
|
|
321
318
|
],
|
|
322
|
-
options: [{ fixSameNames: true }],
|
|
323
319
|
output: `
|
|
324
320
|
test ? deferA : deferB
|
|
325
321
|
test ? pending_a : pending_b
|
|
@@ -338,7 +334,6 @@ exports.module = (valid, invalid) => {
|
|
|
338
334
|
line: 3,
|
|
339
335
|
column: 8
|
|
340
336
|
}],
|
|
341
|
-
options: [{ fixSameNames: true }],
|
|
342
337
|
output: `
|
|
343
338
|
export * as camelCase from "module"
|
|
344
339
|
var camel_case
|
|
@@ -359,6 +354,7 @@ exports.module = (valid, invalid) => {
|
|
|
359
354
|
line: 3,
|
|
360
355
|
column: 8
|
|
361
356
|
}],
|
|
357
|
+
options: [{ fixSameNames: false }],
|
|
362
358
|
output: `
|
|
363
359
|
export default camelCase
|
|
364
360
|
var camel_case
|
|
@@ -385,7 +381,6 @@ exports.module = (valid, invalid) => {
|
|
|
385
381
|
column: 8
|
|
386
382
|
},
|
|
387
383
|
],
|
|
388
|
-
options: [{ fixSameNames: true }],
|
|
389
384
|
output: `
|
|
390
385
|
export default camel_case
|
|
391
386
|
var camel_case
|
|
@@ -413,7 +408,6 @@ exports.module = (valid, invalid) => {
|
|
|
413
408
|
column: 19
|
|
414
409
|
},
|
|
415
410
|
],
|
|
416
|
-
options: [{ fixSameNames: true }],
|
|
417
411
|
output: `
|
|
418
412
|
export { default as camelCase, camelCase2 } from 'module'
|
|
419
413
|
var camel_case, camel_case2
|
|
@@ -448,7 +442,6 @@ exports.module = (valid, invalid) => {
|
|
|
448
442
|
column: 4
|
|
449
443
|
}
|
|
450
444
|
],
|
|
451
|
-
options: [{ fixSameNames: true }],
|
|
452
445
|
output: `
|
|
453
446
|
deferA
|
|
454
447
|
pending_a
|
|
@@ -486,7 +479,6 @@ exports.module = (valid, invalid) => {
|
|
|
486
479
|
column: 23
|
|
487
480
|
}
|
|
488
481
|
],
|
|
489
|
-
options: [{ fixSameNames: true }],
|
|
490
482
|
output: `
|
|
491
483
|
for (camel_case in deferA) {}
|
|
492
484
|
for (snake_case in pending_a) {}
|
|
@@ -550,7 +542,6 @@ exports.module = (valid, invalid) => {
|
|
|
550
542
|
column: 29
|
|
551
543
|
}
|
|
552
544
|
],
|
|
553
|
-
options: [{ fixSameNames: true }],
|
|
554
545
|
output: `
|
|
555
546
|
for (deferA; deferB; deferC) {}
|
|
556
547
|
for (pending_a; pending_b; pending_c) {}
|
|
@@ -613,7 +604,6 @@ exports.module = (valid, invalid) => {
|
|
|
613
604
|
column: 8
|
|
614
605
|
}
|
|
615
606
|
],
|
|
616
|
-
options: [{ fixSameNames: true }],
|
|
617
607
|
output: `
|
|
618
608
|
if (deferA) {}
|
|
619
609
|
if (pending_a) {}
|
|
@@ -668,7 +658,6 @@ exports.module = (valid, invalid) => {
|
|
|
668
658
|
column: 4
|
|
669
659
|
}
|
|
670
660
|
],
|
|
671
|
-
options: [{ fixSameNames: true }],
|
|
672
661
|
output: `
|
|
673
662
|
import { imported as camel_case, camelCase2, camelCase3 } from "module"
|
|
674
663
|
camel_case
|
|
@@ -719,7 +708,6 @@ exports.module = (valid, invalid) => {
|
|
|
719
708
|
column: 16
|
|
720
709
|
}
|
|
721
710
|
],
|
|
722
|
-
options: [{ fixSameNames: true }],
|
|
723
711
|
output: `
|
|
724
712
|
deferA && deferB
|
|
725
713
|
pending_a || pending_b
|
|
@@ -772,7 +760,6 @@ exports.module = (valid, invalid) => {
|
|
|
772
760
|
column: 11
|
|
773
761
|
}
|
|
774
762
|
],
|
|
775
|
-
options: [{ fixSameNames: true }],
|
|
776
763
|
output: `
|
|
777
764
|
deferA.camelCase
|
|
778
765
|
pending_a.camelCase
|
|
@@ -826,7 +813,6 @@ exports.module = (valid, invalid) => {
|
|
|
826
813
|
column: 8
|
|
827
814
|
}
|
|
828
815
|
],
|
|
829
|
-
options: [{ fixSameNames: true }],
|
|
830
816
|
output: `
|
|
831
817
|
new deferA
|
|
832
818
|
new pending_a
|
|
@@ -865,7 +851,6 @@ exports.module = (valid, invalid) => {
|
|
|
865
851
|
column: 18
|
|
866
852
|
}
|
|
867
853
|
],
|
|
868
|
-
options: [{ fixSameNames: true }],
|
|
869
854
|
output: `
|
|
870
855
|
var value = { camelCase: deferA }
|
|
871
856
|
var value = { key: pending_a }
|
|
@@ -893,7 +878,6 @@ exports.module = (valid, invalid) => {
|
|
|
893
878
|
column: 19
|
|
894
879
|
}
|
|
895
880
|
],
|
|
896
|
-
options: [{ fixSameNames: true }],
|
|
897
881
|
output: `
|
|
898
882
|
class ObjectB { camelCase = camelCase2 }
|
|
899
883
|
var camel_case, camel_case2
|
|
@@ -918,7 +902,6 @@ exports.module = (valid, invalid) => {
|
|
|
918
902
|
column: 13
|
|
919
903
|
}
|
|
920
904
|
],
|
|
921
|
-
options: [{ fixSameNames: true }],
|
|
922
905
|
output: `
|
|
923
906
|
var [ ...camel_case_a ] = value
|
|
924
907
|
var { ...camel_case_b } = value
|
|
@@ -950,7 +933,6 @@ exports.module = (valid, invalid) => {
|
|
|
950
933
|
column: 31
|
|
951
934
|
}
|
|
952
935
|
],
|
|
953
|
-
options: [{ fixSameNames: true }],
|
|
954
936
|
output: `
|
|
955
937
|
function func_a() { return deferA }
|
|
956
938
|
function func_b() { return pending_a }
|
|
@@ -983,7 +965,6 @@ exports.module = (valid, invalid) => {
|
|
|
983
965
|
column: 10
|
|
984
966
|
}
|
|
985
967
|
],
|
|
986
|
-
options: [{ fixSameNames: true }],
|
|
987
968
|
output: `
|
|
988
969
|
a, b, deferA
|
|
989
970
|
a, b, pending_a
|
|
@@ -1031,7 +1012,6 @@ exports.module = (valid, invalid) => {
|
|
|
1031
1012
|
column: 31
|
|
1032
1013
|
}
|
|
1033
1014
|
],
|
|
1034
|
-
options: [{ fixSameNames: true }],
|
|
1035
1015
|
output: `
|
|
1036
1016
|
var value = [ ...deferA, deferB ]
|
|
1037
1017
|
var value = [ ...pending_a, pending_b ]
|
|
@@ -1065,7 +1045,6 @@ exports.module = (valid, invalid) => {
|
|
|
1065
1045
|
column: 12
|
|
1066
1046
|
}
|
|
1067
1047
|
],
|
|
1068
|
-
options: [{ fixSameNames: true }],
|
|
1069
1048
|
output: `
|
|
1070
1049
|
switch (deferA) {}
|
|
1071
1050
|
switch (pending_a) {}
|
|
@@ -1098,7 +1077,6 @@ exports.module = (valid, invalid) => {
|
|
|
1098
1077
|
column: 25
|
|
1099
1078
|
}
|
|
1100
1079
|
],
|
|
1101
|
-
options: [{ fixSameNames: true }],
|
|
1102
1080
|
output: `
|
|
1103
1081
|
switch (cond) { case deferA: break }
|
|
1104
1082
|
switch (cond) { case pending_a: break }
|
|
@@ -1131,7 +1109,6 @@ exports.module = (valid, invalid) => {
|
|
|
1131
1109
|
column: 4
|
|
1132
1110
|
}
|
|
1133
1111
|
],
|
|
1134
|
-
options: [{ fixSameNames: true }],
|
|
1135
1112
|
output: `
|
|
1136
1113
|
deferA\`quasis\${expression}quasis\`
|
|
1137
1114
|
pending_a\`quasis\${expression}quasis\`
|
|
@@ -1165,7 +1142,6 @@ exports.module = (valid, invalid) => {
|
|
|
1165
1142
|
column: 10
|
|
1166
1143
|
}
|
|
1167
1144
|
],
|
|
1168
|
-
options: [{ fixSameNames: true }],
|
|
1169
1145
|
output: `
|
|
1170
1146
|
throw deferA
|
|
1171
1147
|
throw pending_a
|
|
@@ -1198,7 +1174,6 @@ exports.module = (valid, invalid) => {
|
|
|
1198
1174
|
column: 5
|
|
1199
1175
|
}
|
|
1200
1176
|
],
|
|
1201
|
-
options: [{ fixSameNames: true }],
|
|
1202
1177
|
output: `
|
|
1203
1178
|
+deferA
|
|
1204
1179
|
-pending_a
|
|
@@ -1231,7 +1206,6 @@ exports.module = (valid, invalid) => {
|
|
|
1231
1206
|
column: 4
|
|
1232
1207
|
}
|
|
1233
1208
|
],
|
|
1234
|
-
options: [{ fixSameNames: true }],
|
|
1235
1209
|
output: `
|
|
1236
1210
|
++deferA
|
|
1237
1211
|
--pending_a
|
|
@@ -1276,7 +1250,6 @@ exports.module = (valid, invalid) => {
|
|
|
1276
1250
|
column: 15
|
|
1277
1251
|
}
|
|
1278
1252
|
],
|
|
1279
|
-
options: [{ fixSameNames: true }],
|
|
1280
1253
|
output: `
|
|
1281
1254
|
var camel_case = deferA
|
|
1282
1255
|
var snake_case = pending_a
|
|
@@ -1315,7 +1288,6 @@ exports.module = (valid, invalid) => {
|
|
|
1315
1288
|
column: 11
|
|
1316
1289
|
}
|
|
1317
1290
|
],
|
|
1318
|
-
options: [{ fixSameNames: true }],
|
|
1319
1291
|
output: `
|
|
1320
1292
|
while (deferA) {}
|
|
1321
1293
|
while (pending_a) {}
|
|
@@ -1348,7 +1320,6 @@ exports.module = (valid, invalid) => {
|
|
|
1348
1320
|
column: 10
|
|
1349
1321
|
}
|
|
1350
1322
|
],
|
|
1351
|
-
options: [{ fixSameNames: true }],
|
|
1352
1323
|
output: `
|
|
1353
1324
|
with (deferA) {}
|
|
1354
1325
|
with (pending_a) {}
|
|
@@ -1381,7 +1352,6 @@ exports.module = (valid, invalid) => {
|
|
|
1381
1352
|
column: 31
|
|
1382
1353
|
}
|
|
1383
1354
|
],
|
|
1384
|
-
options: [{ fixSameNames: true }],
|
|
1385
1355
|
output: `
|
|
1386
1356
|
function* func_a() { yield deferA }
|
|
1387
1357
|
function* func_b() { yield pending_a }
|