Skip to content

Commit cd335ca

Browse files
committed
Update doc
1 parent d0b5757 commit cd335ca

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ The [`@ota-meshi/eslint-plugin-svelte`] is an ESLint plugin that uses The [svelt
2828
[`@ota-meshi/eslint-plugin-svelte`]: https://github.com/ota-meshi/eslint-plugin-svelte
2929
[implemented some rules]: https://ota-meshi.github.io/eslint-plugin-svelte/rules/
3030

31+
### Benefits of Using AST
32+
33+
- We can create rules using the information contained in the AST. e.g. [@ota-meshi/svelte/no-dupe-else-if-blocks](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-dupe-else-if-blocks.html), [@ota-meshi/svelte/no-at-html-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-html-tags.html), and [@ota-meshi/svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags.html) rules.
34+
- Rules that use text work well. e.g. [eol-last](https://eslint.org/docs/rules/eol-last), [unicode-bom](https://eslint.org/docs/rules/unicode-bom) rules, and [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier).
35+
3136
## ❗ Attention
3237

3338
The [svelte-eslint-parser] can not be used with the [eslint-plugin-svelte3].

explorer/vue.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ module.exports = {
3232
test: /node_modules\/eslint-plugin-svelte3\/index\.js$/u,
3333
loader: "string-replace-loader",
3434
options: {
35-
search:
36-
"throw new Error\\('Could not find ESLint Linter in require cache'\\);",
35+
search: "throw new Error\\('Could not find ESLint Linter in require cache'\\);",
3736
replace: (original) => ` // ${original}`,
3837
flags: "",
3938
},

src/context/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ export class Context {
125125
}
126126

127127
/** Extract <script> blocks */
128-
function* extractScriptBlocks(
129-
code: string,
130-
): IterableIterator<{
128+
function* extractScriptBlocks(code: string): IterableIterator<{
131129
code: string
132130
codeRange: [number, number]
133131
tag: string
@@ -145,7 +143,8 @@ function* extractScriptBlocks(
145143
]
146144

147145
// eslint-disable-next-line regexp/no-unused-capturing-group -- maybe bug
148-
const attrRe = /(<key>[^\s=]+)(?:=(?:"(<val>[^"]*)"|'(<val>[^"]*)'|(<val>[^\s=]+)))?/giu
146+
const attrRe =
147+
/(<key>[^\s=]+)(?:=(?:"(<val>[^"]*)"|'(<val>[^"]*)'|(<val>[^\s=]+)))?/giu
149148
const attrs: Record<string, string | undefined> = {}
150149
while ((res = attrRe.exec(attributes))) {
151150
attrs[res.groups!.key] = res.groups!.val

src/parser/converts/attr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ function convertLetDirective(
379379
function processDirective<
380380
D extends SvAST.Directive,
381381
S extends SvelteDirective,
382-
E extends D["expression"] & S["expression"]
382+
E extends D["expression"] & S["expression"],
383383
>(
384384
node: D & { expression: null | E },
385385
directive: S,

src/parser/converts/element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ function convertSlotTemplateElement(
455455

456456
/** Extract element tag and tokens */
457457
export function extractElementTags<
458-
E extends SvelteScriptElement | SvelteElement | SvelteStyleElement
458+
E extends SvelteScriptElement | SvelteElement | SvelteStyleElement,
459459
>(
460460
element: E,
461461
ctx: Context,

tests/src/parser/test-utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ export function* listupFixtures(): IterableIterator<{
1414
yield* listupFixturesImpl(AST_FIXTURE_ROOT)
1515
}
1616

17-
function* listupFixturesImpl(
18-
dir: string,
19-
): IterableIterator<{
17+
function* listupFixturesImpl(dir: string): IterableIterator<{
2018
input: string
2119
inputFileName: string
2220
outputFileName: string

0 commit comments

Comments
 (0)