Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type-safe ParseErrors #14320

Merged
merged 104 commits into from Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
ad551b6
Flow ParseError version.
tolmasky Feb 8, 2022
9d5bf3a
Begin updating everything.
tolmasky Feb 9, 2022
11794cb
Convert more.
tolmasky Feb 9, 2022
ee2037f
Add more.
tolmasky Feb 10, 2022
6a339a1
Fix.
tolmasky Feb 10, 2022
bb7d02b
Just switch everything to exact types.
tolmasky Feb 10, 2022
50e259a
Style fixes.
tolmasky Feb 10, 2022
9e5643d
Fix remaining style issues and remove unecessary dry-error-messages.
tolmasky Feb 10, 2022
7b0b990
Don't use enums and address more issues.
tolmasky Feb 10, 2022
fbd4765
More fixes.
tolmasky Feb 10, 2022
5725a17
Workaround for import situation.
tolmasky Feb 11, 2022
9c1fe56
Fix a bunch of errors messages.
tolmasky Feb 12, 2022
193f473
Fix some flow stuff.
tolmasky Feb 12, 2022
c788091
Add a way to specify code.
tolmasky Feb 12, 2022
78e9eb3
Fix lint errors.
tolmasky Feb 12, 2022
8c3c405
Fix Flow errors.
tolmasky Feb 15, 2022
2d6868d
See if this gets the name right.
tolmasky Feb 15, 2022
fc112ee
Add comments to raise and raiseOverwrite.
tolmasky Feb 20, 2022
6b21909
Remove forward declaration.
tolmasky Feb 20, 2022
774c78b
Change option to be kind.
tolmasky Feb 14, 2022
c8ac0f5
Fix for ambient context not being respected in variable declarations.
tolmasky Feb 15, 2022
3d08b30
Make IllegalBreakContinue based on type.
tolmasky Feb 15, 2022
fd50741
Begin moving checkLVal to type-based system instead of contextDescrip…
tolmasky Feb 12, 2022
b8eb3ce
Switch to isValidLVal.
tolmasky Feb 14, 2022
455512e
Don't use checkLVal for class names.
tolmasky Feb 14, 2022
b040a52
Fix some Flow errors.
tolmasky Feb 15, 2022
833d631
Temporary fix for Flow error.
tolmasky Feb 15, 2022
dd74fc7
Remove unused stuff.
tolmasky Feb 15, 2022
c5c21c5
Try this.
tolmasky Feb 15, 2022
afefe3a
Don't use Object.fromEntries.
tolmasky Feb 15, 2022
ee26f35
Fix linter error.
tolmasky Feb 16, 2022
b10acd0
Fix for SyntaxError.
tolmasky Feb 16, 2022
2608cdd
Add TS1039 Initializers are not allowed in ambient contexts. to error…
tolmasky Feb 16, 2022
1f908f4
Add TS1155 'const' declarations must be initialized.
tolmasky Feb 16, 2022
b169766
Allow consts with literals.
tolmasky Feb 16, 2022
c69ee85
Add enum support.
tolmasky Feb 16, 2022
4fcecf3
Add filename to test runner to correctly identify .d.ts files.
tolmasky Feb 16, 2022
6fa0c4a
Only ignore reserved words in ambient contexts. Parse interface in pa…
tolmasky Feb 17, 2022
00644ee
Fix simple parameter error.
tolmasky Feb 18, 2022
b791955
Type references should allow reserved words (I believe we were just g…
tolmasky Feb 18, 2022
708248b
Allow import and export in TypeScript regardless of module or script.
tolmasky Feb 18, 2022
6415b84
Fix declare enum and interface and reorganize the code a bit.
tolmasky Feb 18, 2022
085361f
Fix for keywords in export as.
tolmasky Feb 18, 2022
7327182
Fix reserved words in import types.
tolmasky Feb 19, 2022
624a102
Rename files.
tolmasky Feb 19, 2022
5e6a905
Add 1
tolmasky Feb 19, 2022
3db388e
Remove files form allowlist that no longer need to be there.
tolmasky Feb 16, 2022
c9a977b
Parse as separate files and switch to only using error codes.
tolmasky Feb 16, 2022
68ed506
Fix reading files with different encodings.
tolmasky Feb 18, 2022
8f96d64
Fix outside tests.
tolmasky Feb 18, 2022
8eb49b9
Change test to pass since typescript should allow import.
tolmasky Feb 18, 2022
5ffc234
Update tests that should fail.
tolmasky Feb 15, 2022
4632b28
Add tests for complex let assignments.
tolmasky Feb 19, 2022
40c51b6
Choose a better name for these.
tolmasky Feb 20, 2022
c108c7e
Add tests for a number of left-hand side expressions.
tolmasky Feb 20, 2022
660971f
Change name to kind.
tolmasky Feb 20, 2022
690c3c3
Choose better parameter names for these errors.
tolmasky Feb 22, 2022
e4137ee
Use error credentials and error details.
tolmasky Feb 23, 2022
e87144f
Fix some names and add comments.
tolmasky Feb 23, 2022
4de1abd
Get rid of unused option.
tolmasky Feb 23, 2022
8357cb3
Better names.
tolmasky Feb 23, 2022
f81a139
Split out pipeline errors and choose better names.
tolmasky Feb 23, 2022
d5522fd
Clean up LVal stuff.
tolmasky Feb 25, 2022
58a7cf8
Use "unambiguous" to determine whether to parse typescript tests as m…
tolmasky Feb 25, 2022
852b89d
Revert test to previous state.
tolmasky Feb 26, 2022
7da1432
Better name for this.
tolmasky Feb 26, 2022
3cfd9b1
Add these back in.
tolmasky Feb 26, 2022
71c13fb
Add these.
tolmasky Feb 26, 2022
e212e22
Fix flow errors and use toNodeDescription in more places.
tolmasky Feb 28, 2022
50314f6
Rename LHSParent to LValAncestor.
tolmasky Feb 28, 2022
a52943b
Add ParseError.clone and change symbol name to DefaultMessage from No…
tolmasky Feb 28, 2022
a64ab03
Change name to identifierName in a bunch of places.
tolmasky Feb 28, 2022
7af22ea
Fix for using type.
tolmasky Mar 1, 2022
4af3e28
Better names.
tolmasky Mar 1, 2022
75d62ab
Clean up API and add comments.
tolmasky Mar 1, 2022
124cb19
Change name.
tolmasky Mar 1, 2022
fe1daf4
Better names.
tolmasky Mar 1, 2022
2cb6231
Minor comment fix.
tolmasky Mar 2, 2022
9322f3f
Remove no longer used method.
tolmasky Mar 2, 2022
084d475
Update packages/babel-parser/src/parser/lval.js
tolmasky Mar 2, 2022
b92b541
Update packages/babel-parser/src/parser/lval.js
tolmasky Mar 2, 2022
359da55
Minor grammar changes to comments.
tolmasky Mar 2, 2022
7248dfd
Use trim instead of slice(0, -1).
tolmasky Mar 2, 2022
e7e4393
Add a comment to explain the tagged template stuff.
tolmasky Mar 2, 2022
6a418de
Use maxArgumentCount.
tolmasky Mar 2, 2022
54ddad5
Don't allow UpdateExpression without prefix.
tolmasky Mar 2, 2022
69ec1d3
Add tds test for no-initializer.
tolmasky Mar 2, 2022
7159c84
Make this test test ASI and not const initializers.
tolmasky Mar 2, 2022
28bbe47
Update packages/babel-parser/src/parser/expression.js
tolmasky Mar 2, 2022
e0a3615
Change template string to normal string and remove default.
tolmasky Mar 3, 2022
b9206ef
Get rid of ParseError class and use SyntaxErrors instead.
tolmasky Mar 4, 2022
4f12b28
Update packages/babel-parser/src/parse-error.js
tolmasky Mar 4, 2022
aa6240f
Remove this comment since we don't need this argument anymore.
tolmasky Mar 5, 2022
dfafab9
Use this in toMessage and restore clone method.
tolmasky Mar 5, 2022
3803c07
Make sure pos and missingPlugin are enumerable.
tolmasky Mar 6, 2022
bcc473e
Make typescript tests faster by checking the bom manually.
tolmasky Mar 6, 2022
b6ca63f
Update packages/babel-parser/src/parser/lval.js
tolmasky Mar 6, 2022
f628099
Update packages/babel-parser/src/plugins/estree.js
tolmasky Mar 6, 2022
38340d4
Update packages/babel-parser/src/plugins/typescript/index.js
tolmasky Mar 6, 2022
192cc85
Update packages/babel-parser/src/plugins/typescript/index.js
tolmasky Mar 6, 2022
a1da9a6
Clarify const enum initialization comment.
tolmasky Mar 6, 2022
c5f96fd
Fix Flow being angry because __proto__: null makes it think that the …
tolmasky Mar 6, 2022
06a3459
Don't automatically set DTS on the typescript plugin based on filename.
tolmasky Mar 6, 2022
12faef0
Fix duplicated export error.
tolmasky Mar 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 0 additions & 17 deletions .eslintrc.cjs
@@ -1,7 +1,5 @@
"use strict";

const path = require("path");

const cjsGlobals = ["__dirname", "__filename", "require", "module", "exports"];

const testFiles = [
Expand Down Expand Up @@ -105,21 +103,6 @@ module.exports = {
eqeqeq: ["error", "always", { null: "ignore" }],
},
},
{
files: ["packages/babel-parser/src/**/*.{js,ts}"],
rules: {
"@babel/development-internal/dry-error-messages": [
"error",
{
errorModule: path.resolve(
__dirname,
"packages/babel-parser/src/parser/error.js"
),
},
],
"@babel/development-internal/report-error-message-format": "error",
},
},
{
files: ["packages/babel-helpers/src/helpers/**.js"],
rules: {
Expand Down
45 changes: 0 additions & 45 deletions eslint/babel-eslint-plugin-development-internal/README.md
Expand Up @@ -24,51 +24,6 @@ The plugin can be loaded in your `.eslintrc.*` configuration file as follows: (n

## Rules

### `@babel/development-internal/dry-error-messages`

Intended for use in `packages/babel-parser/src/**/*`. When enabled, this rule warns when `this.raise()` invocations raise errors that are not imported from a designated error module.

Accepts an object configuration option:

```ts
{
errorModule: string
}
```

`errorModule` (required): The rule expects either an absolute path or a module name (for a module in `node_modules`). Please note that the rule will not check anything if` errorModule` is not given.

Example configuration:

```js
{
rules: {
"@babel/development-internal/dry-error-messages": [
"error",
{
errorModule: "@babel/shared-error-messages"
}
]
}
}
```
and
```js
{
rules: {
"@babel/development-internal/dry-error-messages": [
"error",
{
errorModule: path.resolve(
__dirname,
"packages/shared-error-messages/lib/index.js"
)
}
]
}
}
```

### `@babel/development-internal/report-error-message-format`

This rule is inspired by https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/report-message-format.md.
Expand Down
2 changes: 0 additions & 2 deletions eslint/babel-eslint-plugin-development-internal/src/index.cjs
@@ -1,8 +1,6 @@
const dryErrorMessages = require("./rules/dry-error-messages.cjs");
const reportErrorMessageFormat = require("./rules/report-error-message-format.cjs");

const rules = {
"dry-error-messages": dryErrorMessages,
"report-error-message-format": reportErrorMessageFormat,
};

Expand Down

This file was deleted.