Skip to content

Commit 96fda16

Browse files
committed
Move rule type into parser
1 parent 7f2d14d commit 96fda16

29 files changed

+104
-41
lines changed

src/parser/source/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { parse as acornParse, Token, tokenizer } from 'acorn'
22
import * as es from 'estree'
33

44
import { DEFAULT_ECMA_VERSION } from '../../constants'
5-
import { Chapter, Context, Node, Rule, SourceError, Variant } from '../../types'
5+
import { Chapter, Context, Node, SourceError, Variant } from '../../types'
6+
import { Rule } from '../types'
67
import { ancestor, AncestorWalkerFn } from '../../utils/walkers'
78
import { DisallowedConstructError, FatalSyntaxError } from '../errors'
89
import { AcornOptions, Parser } from '../types'

src/parser/source/rules/bracesAroundFor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { generate } from 'astring'
22
import * as es from 'estree'
33

44
import { UNKNOWN_LOCATION } from '../../../constants'
5-
import { ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
5+
import { ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
6+
import { Rule } from '../../types'
67

78
export class BracesAroundForError implements SourceError {
89
public type = ErrorType.SYNTAX

src/parser/source/rules/bracesAroundIfElse.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { generate } from 'astring'
22
import * as es from 'estree'
33

44
import { UNKNOWN_LOCATION } from '../../../constants'
5-
import { ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
5+
import { ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
6+
import { Rule } from '../../types'
67
import { stripIndent } from '../../../utils/formatters'
78

89
export class BracesAroundIfElseError implements SourceError {

src/parser/source/rules/bracesAroundWhile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { generate } from 'astring'
22
import * as es from 'estree'
33

44
import { UNKNOWN_LOCATION } from '../../../constants'
5-
import { ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
5+
import { ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
6+
import { Rule } from '../../types'
67

78
export class BracesAroundWhileError implements SourceError {
89
public type = ErrorType.SYNTAX

src/parser/source/rules/forStatementMustHaveAllParts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as es from 'estree'
22

33
import { UNKNOWN_LOCATION } from '../../../constants'
4-
import { ErrorSeverity, ErrorType, Rule, SourceError } from '../../../types'
4+
import { ErrorSeverity, ErrorType, SourceError } from '../../../types'
5+
import { Rule } from '../../types'
56
import { stripIndent } from '../../../utils/formatters'
67

78
export class ForStatmentMustHaveAllParts implements SourceError {

src/parser/source/rules/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Node, Rule } from '../../../types'
1+
import { Node } from '../../../types'
2+
import { Rule } from '../../types'
23
import bracesAroundFor from './bracesAroundFor'
34
import bracesAroundIfElse from './bracesAroundIfElse'
45
import bracesAroundWhile from './bracesAroundWhile'
@@ -7,6 +8,7 @@ import noDeclareMutable from './noDeclareMutable'
78
import noDotAbbreviation from './noDotAbbreviation'
89
import noEval from './noEval'
910
import noExportNamedDeclarationWithDefault from './noExportNamedDeclarationWithDefault'
11+
import noExportNamedDeclarationWithSource from './noExportNamedDeclarationWithSource'
1012
import noFunctionDeclarationWithoutIdentifier from './noFunctionDeclarationWithoutIdentifier'
1113
import noHolesInArrays from './noHolesInArrays'
1214
import noIfWithoutElse from './noIfWithoutElse'
@@ -31,6 +33,7 @@ const rules: Rule<Node>[] = [
3133
noDeclareMutable,
3234
noDotAbbreviation,
3335
noExportNamedDeclarationWithDefault,
36+
noExportNamedDeclarationWithSource,
3437
noFunctionDeclarationWithoutIdentifier,
3538
noIfWithoutElse,
3639
noImportSpecifierWithDefault,

src/parser/source/rules/noDeclareMutable.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { generate } from 'astring'
22
import * as es from 'estree'
33

44
import { UNKNOWN_LOCATION } from '../../../constants'
5-
import { Chapter, ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
5+
import { Chapter, ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
6+
import { Rule } from '../../types'
67

78
const mutableDeclarators = ['let', 'var']
89

src/parser/source/rules/noDotAbbreviation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as es from 'estree'
22

33
import { UNKNOWN_LOCATION } from '../../../constants'
4-
import { Chapter, ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
4+
import { Chapter, ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
5+
import { Rule } from '../../types'
56

67
export class NoDotAbbreviationError implements SourceError {
78
public type = ErrorType.SYNTAX

src/parser/source/rules/noEval.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as es from 'estree'
22

33
import { UNKNOWN_LOCATION } from '../../../constants'
4-
import { ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
4+
import { ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
5+
import { Rule } from '../../types'
56

67
export class NoEval implements SourceError {
78
public type = ErrorType.SYNTAX

src/parser/source/rules/noExportNamedDeclarationWithDefault.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as es from 'estree'
22

33
import { UNKNOWN_LOCATION } from '../../../constants'
44
import { defaultExportLookupName } from '../../../stdlib/localImport.prelude'
5-
import { ErrorSeverity, ErrorType, Node, Rule, SourceError } from '../../../types'
5+
import { ErrorSeverity, ErrorType, Node, SourceError } from '../../../types'
6+
import { Rule } from '../../types'
67
import syntaxBlacklist from '../syntax'
78

89
export class NoExportNamedDeclarationWithDefaultError implements SourceError {

0 commit comments

Comments
 (0)