File tree 9 files changed +862
-56
lines changed
9 files changed +862
-56
lines changed Original file line number Diff line number Diff line change 18
18
run : npm install
19
19
- name : Lint
20
20
run : npm run lint
21
+ build :
22
+ runs-on : ubuntu-latest
23
+ steps :
24
+ - uses : actions/checkout@v2
25
+ - uses : actions/setup-node@v2
26
+ with :
27
+ node-version : 14
28
+ - name : Install Packages
29
+ run : npm install
30
+ - name : Build
31
+ run : |+
32
+ npm run update
33
+ npm run build
21
34
test :
22
35
name : " Test for ESLint ${{ matrix.eslint }} on ${{ matrix.node }} OS: ${{matrix.os}}"
23
36
runs-on : ${{ matrix.os }}
Original file line number Diff line number Diff line change 23
23
"debug" : " mocha --require ts-node/register/transpile-only \" tests/src/**/*.ts\" --reporter dot --timeout 60000" ,
24
24
"lint" : " eslint ." ,
25
25
"eslint-fix" : " eslint . --fix" ,
26
- "update" : " ts-node --transpile-only ./tools/update.ts && npm run eslint-fix && npm run test" ,
26
+ "update" : " ts-node --transpile-only ./tools/update.ts && npm run format-for-gen-file" ,
27
+ "format-for-gen-file" : " eslint src/types-for-node.ts src/utils/rules.ts src/configs --fix" ,
27
28
"new" : " ts-node --transpile-only ./tools/new-rule.ts" ,
28
29
"docs:watch" : " svelte-kit dev" ,
29
30
"docs:build" : " node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js build" ,
80
81
"@types/eslint" : " ^8.0.0" ,
81
82
"@types/eslint-scope" : " ^3.7.0" ,
82
83
"@types/eslint-visitor-keys" : " ^1.0.0" ,
84
+ "@types/estree" : " ^0.0.50" ,
83
85
"@types/mocha" : " ^9.0.0" ,
84
86
"@types/node" : " ^16.0.0" ,
85
87
"@typescript-eslint/eslint-plugin" : " ^5.4.0" ,
Original file line number Diff line number Diff line change 1
1
import type { AST } from "svelte-eslint-parser"
2
2
import type * as ESTree from "estree"
3
3
import type { TSESTree } from "@typescript-eslint/types"
4
- import type { ASTNode } from "../../types"
5
4
import type { IndentContext } from "./commons"
6
5
import { getFirstAndLastTokens } from "./commons"
7
6
import {
@@ -17,17 +16,9 @@ import {
17
16
isOpeningParenToken ,
18
17
isSemicolonToken ,
19
18
} from "eslint-utils"
19
+ import type { ESNodeListener } from "../../types-for-node"
20
20
21
- type NodeWithParent =
22
- | ( Exclude < ESTree . Node , ESTree . Program > & { parent : ASTNode } )
23
- | AST . SvelteProgram
24
- | AST . SvelteReactiveStatement
25
-
26
- type NodeListener = {
27
- [ key in NodeWithParent [ "type" ] ] : (
28
- node : NodeWithParent & { type : key } ,
29
- ) => void
30
- }
21
+ type NodeListener = ESNodeListener
31
22
32
23
/**
33
24
* Creates AST event handlers for ES nodes.
Original file line number Diff line number Diff line change 1
1
import type { AST } from "svelte-eslint-parser"
2
2
import type { ASTNode } from "../../types"
3
+ import type { SvelteNodeListener } from "../../types-for-node"
3
4
import { isNotWhitespace } from "./ast"
4
5
import type { IndentContext } from "./commons"
5
6
import { isBeginningOfElement } from "./commons"
6
7
import { isBeginningOfLine } from "./commons"
7
8
import { getFirstAndLastTokens } from "./commons"
8
- type NodeWithoutES = Exclude <
9
- AST . SvelteNode ,
10
- AST . SvelteProgram | AST . SvelteReactiveStatement
11
- >
12
9
13
- type NodeListener = {
14
- [ key in NodeWithoutES [ "type" ] ] : ( node : NodeWithoutES & { type : key } ) => void
15
- }
10
+ type NodeListener = SvelteNodeListener
16
11
const PREFORMATTED_ELEMENT_NAMES = [ "pre" , "textarea" , "template" ]
17
12
18
13
/**
Original file line number Diff line number Diff line change @@ -13,29 +13,9 @@ import {
13
13
import type { AnyToken , IndentContext } from "./commons"
14
14
import { isBeginningOfLine } from "./commons"
15
15
import { getFirstAndLastTokens } from "./commons"
16
+ import type { TSNodeListener } from "../../types-for-node"
16
17
17
- type NodeWithoutES = Exclude <
18
- TSESTree . Node ,
19
- | { type : ESTree . Node [ "type" ] }
20
- | TSESTree . JSXAttribute
21
- | TSESTree . JSXClosingElement
22
- | TSESTree . JSXClosingFragment
23
- | TSESTree . JSXElement
24
- | TSESTree . JSXEmptyExpression
25
- | TSESTree . JSXExpressionContainer
26
- | TSESTree . JSXFragment
27
- | TSESTree . JSXIdentifier
28
- | TSESTree . JSXMemberExpression
29
- | TSESTree . JSXNamespacedName
30
- | TSESTree . JSXOpeningElement
31
- | TSESTree . JSXOpeningFragment
32
- | TSESTree . JSXSpreadAttribute
33
- | TSESTree . JSXSpreadChild
34
- | TSESTree . JSXText
35
- >
36
- type NodeListener = {
37
- [ key in NodeWithoutES [ "type" ] ] : ( node : NodeWithoutES & { type : key } ) => void
38
- }
18
+ type NodeListener = TSNodeListener
39
19
40
20
/**
41
21
* Creates AST event handlers for svelte nodes.
You can’t perform that action at this time.
0 commit comments