Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(typescript-estree): enable error codes TS1085 and TS8017 for legacy octal literals#7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JamesHenry merged 5 commits intotypescript-eslint:masterfromarmano2:legacy-octal
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
(a) =>00;
(a) =>0o0;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
0x12z;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
0x2343;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
0X2343;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
02343;
5 changes: 3 additions & 2 deletionspackages/typescript-estree/src/convert.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1779,13 +1779,14 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
}
break;

case SyntaxKind.NumericLiteral:
case SyntaxKind.NumericLiteral: {
Object.assign(result, {
type: AST_NODE_TYPES.Literal,
value: Number(node.text),
raw:ast.text.slice(result.range[0], result.range[1])
raw:node.getText()
});
break;
}

case SyntaxKind.BigIntLiteral: {
const raw = ast.text.slice(result.range[0], result.range[1]);
Expand Down
2 changes: 2 additions & 0 deletionspackages/typescript-estree/src/semantic-errors.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,6 +61,7 @@ function whitelistSupportedDiagnostics(
case 1049: // ts 3.2 "A 'set' accessor must have exactly one parameter."
case 1070: // ts 3.2 "'{0}' modifier cannot appear on a type member."
case 1071: // ts 3.2 "'{0}' modifier cannot appear on an index signature."
case 1085: // ts 3.2 "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."
case 1090: // ts 3.2 "'{0}' modifier cannot appear on a parameter."
case 1096: // ts 3.2 "An index signature must have exactly one parameter."
case 1097: // ts 3.2 "'{0}' list cannot be empty."
Expand All@@ -83,6 +84,7 @@ function whitelistSupportedDiagnostics(
case 2364: // ts 3.2 "The left-hand side of an assignment expression must be a variable or a property access."
case 2369: // ts 3.2 "A parameter property is only allowed in a constructor implementation."
case 2462: // ts 3.2 "A rest element must be last in a destructuring pattern."
case 8017: // ts 3.2 "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."
case 17012: // ts 3.2 "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"
case 17013: // ts 3.2 "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."
return true;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -91,7 +91,7 @@ class FixturesTester {
}

public getFixtures(): Fixture[] {
const fixtures = this.fixtures
return this.fixtures
.map(fixture =>
glob
.sync(`${fixture.directory}/${fixture.pattern}`, {})
Expand All@@ -102,8 +102,6 @@ class FixturesTester {
}))
)
.reduce((acc, x) => acc.concat(x), []);

return fixtures;
}
}

Expand DownExpand Up@@ -225,6 +223,7 @@ tester.addFixturePatternConfig('javascript/forIn', {
tester.addFixturePatternConfig('javascript/forOf');
tester.addFixturePatternConfig('javascript/generators');
tester.addFixturePatternConfig('javascript/globalReturn');
tester.addFixturePatternConfig('javascript/hexLiterals');
tester.addFixturePatternConfig('javascript/importMeta');
tester.addFixturePatternConfig('javascript/labels');

Expand DownExpand Up@@ -264,7 +263,15 @@ tester.addFixturePatternConfig('javascript/objectLiteralDuplicateProperties', {

tester.addFixturePatternConfig('javascript/objectLiteralShorthandMethods');
tester.addFixturePatternConfig('javascript/objectLiteralShorthandProperties');
tester.addFixturePatternConfig('javascript/octalLiterals');
tester.addFixturePatternConfig('javascript/octalLiterals', {
ignore: [
/**
* Old-style octal literals are not supported in typescript
* @see https://github.com/Microsoft/TypeScript/issues/10101
*/
'legacy'
]
});
tester.addFixturePatternConfig('javascript/regex');
tester.addFixturePatternConfig('javascript/regexUFlag');
tester.addFixturePatternConfig('javascript/regexYFlag');
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp