Commit graph

1170 commits

Author SHA1 Message Date
u9g
fd3fa6ca84
feat(query): Add some new types (#761)
```diff
+ BlockStatement
+ BlockStatement implements HasSpan
+ BlockStatement implements Statement
+ BlockStatement.statement

+ BlockStatementAST
+ BlockStatementAST implements BlockStatement
+ BlockStatementAST implements Statement
+ BlockStatementAST implements ASTNode
+ BlockStatementAST implements HasSpan

+ ExpressionStatement
+ ExpressionStatement implements HasSpan
+ ExpressionStatement implements Statement
+ ExpressionStatement.expression

+ ExpressionStatementAST
+ ExpressionStatementAST implements HasSpan
+ ExpressionStatementAST implements ExpressionStatement
+ ExpressionStatementAST implements ASTNode
+ ExpressionStatementAST implements Statement

+ VarRef
+ VarRef implements HasSpan
+ VarRef implements Expression
+ VarRef.name

+ VarRefAST
+ VarRefAST implements HasSpan
+ VarRefAST implements Expression
+ VarRefAST implements VarRef
+ VarRefAST implements ASTNode

+ WhileStatement
+ WhileStatement implements Statement
+ WhileStatement implements HasSpan
+ WhileStatement.condition
+ WhileStatement.body

+ WhileStatementAST
+ WhileStatementAST implements ASTNode
+ WhileStatementAST implements Statement
+ WhileStatementAST implements WhileStatement
+ WhileStatementAST implements HasSpan

```
2023-08-19 16:15:22 +08:00
Boshen
1fdce7e517
refactor(cli): split out group options (#760) 2023-08-19 12:09:35 +08:00
Boshen
6f1daa67b2
refactor(cli): clean up lint and cli options (#759) 2023-08-19 00:06:12 +08:00
Boshen
5bcd736ae9
fix(cli): correctly parse clippy like filters "-A rule -D rule" (#758) 2023-08-18 22:00:05 +08:00
Boshen
772f71f191
refactor(cli): add WalkOptions for walk logic (#757) 2023-08-18 18:09:11 +08:00
Boshen
a9c4fddb6d
refactor(cli): use bpaf instead clap (#756) 2023-08-18 17:14:06 +08:00
u9g
61bf583333
feat(query): New types added (#754)
```diff
+ LogicalExpression
+ LogicalExpression implements HasSpan
+ LogicalExpression implements Expression
+ LogicalExpression.operator
+ LogicalExpression.left
+ LogicalExpression.right

+ LogicalExpressionAST
+ LogicalExpressionAST implements LogicalExpression
+ LogicalExpressionAST implements ASTNode
+ LogicalExpressionAST implements Expression
+ LogicalExpressionAST implements HasSpan

+ Parameter implements HasSpan

+ UnaryExpression
+ UnaryExpression implements HasSpan
+ UnaryExpression implements Expression
+ UnaryExpression.operator
+ UnaryExpression.value

+ UnaryExpressionAST
+ UnaryExpressionAST implements ASTNode
+ UnaryExpressionAST implements Expression
+ UnaryExpressionAST implements HasSpan
+ UnaryExpressionAST implements UnaryExpression
```
2023-08-18 00:04:52 -04:00
Boshen
3110490f36
refactor(cli,linter): move LintOptions from cli to linter (#753)
This also simplifies the Runner trait.
2023-08-17 22:28:34 +08:00
阿良仔
5a73f0e1b5
feat(formatter): add EndOfLine (#747) 2023-08-17 19:04:23 +08:00
Kei Sakamoto
2fde2255f9
feat(linter): implement eslint-plugin-unicorn/no-instanceof-array (#752)
implement
[eslint-plugin-unicorn/no-instanceof-array](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md).
Related issue: #684
2023-08-17 17:08:03 +08:00
Boshen
6ab4ce0a6b
feat(resolver): implement tsconfig-paths (#750)
This PR includes 3 core functinalies of tsconfig-paths:

* matching tsconfig.compilerOptions.paths
* use tsconfig.compilerOptions.baseUrl
* extend tsconfig with tsconfig.extends

This PR does not include tsconfig.references
2023-08-17 16:24:46 +08:00
Boshen
9fa52fa61c
chore: run just fmt 2023-08-17 14:58:59 +08:00
Boshen
6e074a39fd
chore(README): reference licenses 2023-08-17 14:10:54 +08:00
u9g
b346a9ad6d
feat(query): New types and new fields for existing types (#746)
```diff
+ Argument.value
+ Argument implements HasSpan
+ ArgumentAST

- FnCall.arguments
+ FnCall.argument
- FnCallAST.arguments
+ FnCallAST.argument

+ interface Function
+ Function.is_async
+ Function.is_generator
+ Function.parameter
+ Function implements Expression
+ Function implements HasSpan

+ Parameter
+ Parameter.is_readonly
+ Parameter.assignment
+ Parameter.type_annotation
+ Parameter implements HasSpan
+ ParameterAST

+ ArrowFunction implements Function
+ ArrowFunction implements Expression
+ ArrowFunctionAST implements Function
+ ArrowFunctionAST implements Expression


+ FnDeclaration implements Function
+ FnDeclaration implements Expression
+ FnDeclarationAST implements Function
+ FnDeclarationAST implements Expression
```
2023-08-16 00:56:43 -04:00
Lqxc
f4d16c2166
fix(linter): perf @eslint/no-shadow-restricted-names check (#617) (#743)
In previous implements, when facing "undefined = <expr>", the lint will
search all nodes to check if undefined was declared. In this
implementation, the lint will only run once and check all nodes.
2023-08-16 12:24:52 +08:00
Wenzhe Wang
3022655965
feat(linter): add no-commented-out-tests (#723)
port
[no-commented-out-tests](e894f51a0d/docs/rules/no-commented-out-tests.md)
2023-08-16 12:23:46 +08:00
Yunfei He
ec85fd8b7d
fix(eslint/no-obj-calls): should resolve non-global binding correctly (#745)
Fixes #744
2023-08-15 18:37:40 +08:00
u9g
5dc69ea4ec
feat(query): Add many types (#742) 2023-08-15 03:30:59 -04:00
Devin-Yeung
607fa6a2a4
feat(linter): implement typescript-eslint/ban-ts-comment (#741)
related to #503, marked as nursery(though all tests pass) since we use
rust `regex` crate to parse the regex, may have compatibility problems
with ECMA regex.
2023-08-15 13:32:41 +08:00
Devin-Yeung
c0b06a5700
feat(rulegen): automatically detect proxy (#740)
detect `HTTP_PROXY/HTTPS_PROXY/ALL_PROXY` environments automatically,
since visiting https://raw.githubusercontent.com sometimes need proxy,
upstream PR
[algesten/ureq#649](https://github.com/algesten/ureq/pull/649)
2023-08-15 13:32:09 +08:00
Sg
fae9a7c28b
feat(formatter): add "Quote Props" option (#652)
For #634. 



This PR prepares for the fix of #634, adding an option to formatter to
control whether to quote object properties. After this PR, the rulegen
script can use oxc-formatter to output JSON-like object literal.

The `Quote Props` option is from Prettier. For detail:
https://prettier.io/docs/en/options.html#quote-props

> Change when properties in objects are quoted.
> Valid options:
> "as-needed" - Only add quotes around object properties where required.
> "consistent" - If at least one property in an object requires quotes,
quote all properties.
> "preserve" - Respect the input use of quotes in object properties.

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2023-08-15 11:40:38 +08:00
Boshen
b466de522b
fix(ast_lower): remove wrong usage of SymbolFlags::Function (#680)
closes #678

SymbolFlags::Function means something else (the whole function
declaration stored as a anonymous symbol) in TypeScript
2023-08-15 11:37:50 +08:00
Boshen
4fa6aafa3e
feat(resolver): handle path alias with # (#739)
`#` can be:

* an actual path fragment `path#fragment`
* esm import module specifier `#import-path`
* part of a path `path/to/#/fragment`
* part of path alias `#` -> `./path/alias`

This is driving me crazy.
2023-08-14 15:04:09 +08:00
Boshen
7c3e29d421
feat(resolver): expose raw package_json value; improve print debug (#738) 2023-08-14 11:57:17 +08:00
u9g
99a7ad4319
feat(query): add FnCall and Argument types (#737) 2023-08-14 10:25:03 +08:00
Devin-Yeung
a041fbd96b
fix(rulegen): import thiserror correctly (#735)
close #734
2023-08-14 10:20:25 +08:00
Boshen
f6e3b654b1
feat(resolver): implement configurable exports_fields option (#733) 2023-08-14 10:18:57 +08:00
u9g
087abd3cf1
feat(query): Add Reassignment type and add str property to span (#731) 2023-08-13 22:18:41 +08:00
u9g
5e9927745e
feat(website): Improve autocomplete (#730) 2023-08-13 15:31:22 +08:00
Lqxc
6f00461c9d
feat(linter): implement @eslint/no-shadow-restricted-names (#617) (#728)
related issue: #617
2023-08-12 23:58:13 +08:00
Kei Sakamoto
4f5e4c1bac
feat(linter): implement @typescript-eslint/no-duplicate-enum-values (#726)
implement
[@typescript-eslint/no-duplicate-enum-values](https://typescript-eslint.io/rules/no-duplicate-enum-values)
Related issue: #503.
2023-08-12 23:55:26 +08:00
Boshen
37efbd7af3
feat(resolver): resolve # as path instead of a fragment (#727) 2023-08-12 23:51:37 +08:00
Boshen
629055cfce
deps(rust): bump dependencies 2023-08-12 16:48:24 +08:00
Wenzhe Wang
0c645170a8
feat(linter): valid-describe-callback(eslint-plugin-jest) (#706) 2023-08-12 16:47:49 +08:00
u9g
9566378119
feat(query): add many types to oxc_query (#724)
Adds `Name(AST)?`, `IfStatementAST`, `SpreadIntoObject(AST)?`,
`ObjectEntry(AST)?`, `DotProperty(AST)?` types

Fixes `ObjectLiteral`'s value field's output type

Added `entry` field to `ObjectLiteral(AST)?`
2023-08-12 16:43:58 +08:00
u9g
7daab49ca5
feat(website): fix highlighting edgecase in codemirror theme (#725)
Problem described here:
https://discuss.codemirror.net/t/basicsetup-breaks-cursor-highlighting/6964/5
2023-08-12 16:41:58 +08:00
Boshen
9935eb1259 feat(resolver): pass on query string from alias fields 2023-08-11 19:46:57 +08:00
Boshen
17e525cc0f feat(resolver): complete browser_field implementation 2023-08-11 19:46:57 +08:00
Boshen
fdf288c685
refactor: improve code coverage in various places (#721) 2023-08-11 15:17:49 +08:00
u9g
c6ed90900c
feat(query): Add name to class (#720) 2023-08-11 14:36:40 +08:00
u9g
f48db3f85e
fix(website): return early on failed highlight range (#719) 2023-08-11 05:55:58 +00:00
u9g
97c5cd379e
feat(query): Add right to VariableDeclaration (#718) 2023-08-11 05:40:35 +00:00
u9g
9c05866cc1
feat(query): add NumberLiteral type (#717) 2023-08-11 05:37:29 +00:00
u9g
c7fc1d99b5
feat(query): add name to interface (#716) 2023-08-11 05:22:12 +00:00
u9g
a953a96529
fix(query): make ObjectLiteralAST implement ObjectLiteral (#715) 2023-08-11 05:15:22 +00:00
Boshen
8c7109b24e
feat(resolver): check for infinite recursion (#714) 2023-08-11 12:53:42 +08:00
u9g
99a4816ce7
feat(website): add query playground (#698) 2023-08-11 10:53:21 +08:00
Boshen
17a6f63c31
refactor(resolver): remove the leading dot trim on extensions 2023-08-10 21:05:48 +08:00
Boshen
11954326b3 feat(resolver): implement main_fields 2023-08-10 19:48:30 +08:00
Boshen
f717cb02e3 feat(resolver): add exports_fields and main_fields for logging purposes. 2023-08-10 19:48:30 +08:00