Skip to content

Commit 8a24ef2

Browse files
Add eslint-plugin-import (#711)
* Add `eslint-plugin-import` * Use `import/order`
1 parent 60d13b8 commit 8a24ef2

File tree

123 files changed

+2029
-748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+2029
-748
lines changed

.eslintrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = {
1414
"plugin:@ota-meshi/+yaml",
1515
// "plugin:@ota-meshi/+md",
1616
"plugin:@ota-meshi/+prettier",
17+
"plugin:import/recommended",
1718
"plugin:regexp/recommended",
1819
],
1920
rules: {
@@ -73,6 +74,8 @@ module.exports = {
7374
},
7475
],
7576

77+
"import/order": ["warn", { alphabetize: { order: "asc" } }],
78+
7679
// regexp next recommended
7780
"regexp/no-contradiction-with-assertion": "error",
7881
"regexp/no-empty-character-class": "error",
@@ -118,6 +121,12 @@ module.exports = {
118121
"no-implicit-globals": "off",
119122
"@typescript-eslint/naming-convention": "off",
120123
},
124+
settings: {
125+
"import/resolver": {
126+
typescript: true,
127+
node: true,
128+
},
129+
},
121130
},
122131
{
123132
files: ["lib/rules/**"],
@@ -148,6 +157,8 @@ module.exports = {
148157
rules: {
149158
"vue/multi-word-component-names": "off",
150159
"@typescript-eslint/no-explicit-any": "off",
160+
"import/named": "off",
161+
"import/no-unresolved": "off",
151162
},
152163
},
153164
{

docs/.vitepress/build-system/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* Pre-build cjs packages that cannot be bundled well.
33
*/
44

5-
import esbuild from "esbuild"
6-
import path from "path"
75
import fs from "fs"
6+
import path from "path"
87
import { fileURLToPath } from "url"
8+
import esbuild from "esbuild"
99

1010
const dirname = path.dirname(
1111
fileURLToPath(

docs/.vitepress/theme/components/playground-block.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
import PgEditor from "./components/PgEditor.vue"
5050
import RulesSettings from "./components/RulesSettings.vue"
5151
import SnsBar from "./components/SnsBar.vue"
52-
import { deserializeState, serializeState } from "./state"
5352
import { DEFAULT_RULES_CONFIG, getRule } from "./rules"
53+
import { deserializeState, serializeState } from "./state"
5454
5555
const DEFAULT_CODE = String.raw`
5656
/eslint-plugin[-regexp]/u

lib/all-rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { RuleModule } from "./types"
21
import confusingQuantifier from "./rules/confusing-quantifier"
32
import controlCharacterEscape from "./rules/control-character-escape"
43
import graphemeStringLiteral from "./rules/grapheme-string-literal"
@@ -80,6 +79,7 @@ import sortFlags from "./rules/sort-flags"
8079
import strict from "./rules/strict"
8180
import unicodeEscape from "./rules/unicode-escape"
8281
import useIgnoreCase from "./rules/use-ignore-case"
82+
import type { RuleModule } from "./types"
8383

8484
export const rules: RuleModule[] = [
8585
confusingQuantifier,

lib/configs/rules/all.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { rules as recommendedRules } from "./recommended"
21
import { rules as ruleLint } from "../../all-rules"
2+
import { rules as recommendedRules } from "./recommended"
33

44
const all: Record<string, string> = {}
55
for (const rule of ruleLint) {

lib/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { RuleModule } from "./types"
21
import { rules as ruleList } from "./all-rules"
3-
import * as recommended from "./configs/recommended"
42
import * as all from "./configs/all"
5-
import * as flatRecommended from "./configs/flat/recommended"
63
import * as flatAll from "./configs/flat/all"
4+
import * as flatRecommended from "./configs/flat/recommended"
5+
import * as recommended from "./configs/recommended"
6+
import type { RuleModule } from "./types"
77
export * as meta from "./meta"
88

99
export const configs = {

lib/rules/confusing-quantifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
2+
import { isPotentiallyEmpty } from "regexp-ast-analysis"
23
import type { RegExpContext } from "../utils"
34
import { createRule, defineRegexpVisitor } from "../utils"
4-
import { isPotentiallyEmpty } from "regexp-ast-analysis"
55
import { quantToString, getQuantifierOffsets } from "../utils/regexp-ast"
66

77
export default createRule("confusing-quantifier", {

lib/rules/control-character-escape.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { PatternRange } from "../utils/ast-utils/pattern-source"
21
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
32
import type { RegExpContext } from "../utils"
43
import {
@@ -10,6 +9,7 @@ import {
109
createRule,
1110
defineRegexpVisitor,
1211
} from "../utils"
12+
import type { PatternRange } from "../utils/ast-utils/pattern-source"
1313
import { isRegexpLiteral } from "../utils/ast-utils/utils"
1414
import { mentionChar } from "../utils/mention"
1515

lib/rules/grapheme-string-literal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import type { StringAlternative } from "@eslint-community/regexpp/ast"
12
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
23
import type { RegExpContext } from "../utils"
34
import { createRule, defineRegexpVisitor } from "../utils"
4-
import type { StringAlternative } from "@eslint-community/regexpp/ast"
55

66
const segmenter = new Intl.Segmenter()
77

lib/rules/hexadecimal-escape.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
21
import type { Character } from "@eslint-community/regexpp/ast"
2+
import type { RegExpVisitor } from "@eslint-community/regexpp/visitor"
33
import type { RegExpContext } from "../utils"
44
import { defineRegexpVisitor, createRule } from "../utils"
55
import {

0 commit comments

Comments
 (0)