Commit graph

45 commits

Author SHA1 Message Date
DonIsaac
6e3224d5fa feat(linter): configure by category in config files (#6120)
> closes #5454

Adds a `categories` property to config files, where each key is a `RuleCategory` and each value is `"allow"/"off"`, `"warn"`, or `"deny"/"error"`.

Note that this change won't come into effect until after #6088 is merged.
2024-10-08 22:19:07 +00:00
DonIsaac
d24985ed51 feat(linter): add oxc-security/api-keys (#5906)
## What This PR does
Adds a new `oxc-security/api-key` rule that scans for hard-coded API keys.

It is broken up into "secret rules", where each one is responsible for finding a different kind of key. It is architecturally identical to how lint rules themselves. This PR also includes the first of these rules, for AWS access key IDs.

Logic and rules are based on [keyhunter](https://github.com/Donisaac/keyhunter). I've licensed that repo under GNU GPLv3, but it's my code and I can do what I want with it 😈 (read: I'm fine with it being MIT for oxc).

This PR is a complete feature in its own right, but does not represent the end of this work. See https://github.com/oxc-project/backlog/issues/116 to track overall progress.
2024-09-22 22:39:56 +00:00
DonIsaac
ba7b01fbdf refactor(linter): Add LinterBuilder (#5714)
This will replace `OxlintOptions` in an upstream PR. This also adds `plugins` to
`Oxlintrc`. This field gets respected by the builder, but not by
`OxlintOptions`.
2024-09-20 11:58:37 +00:00
DonIsaac
a438743191 refactor(linter): move OxlintConfig to Oxlintrc (#5707) 2024-09-17 05:15:37 +00:00
Boshen
945d2744ae
chore(linter: fix snapshot 2024-09-11 21:07:23 +08:00
dalaoshu
d18c896a2c
perf(rust): use cow_utils instead (#5664)
Related to #5586 and #5662

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-09-11 18:39:30 +08:00
DonIsaac
20d006838e refactor(oxlint): move cli-related exports to cli module (#5139) 2024-09-08 15:29:37 +00:00
Boshen
4a8aec1605 feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
Boshen
63a830e08c
chore(dprint): format toml files (#5599)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
Boshen
28b934ca74 fix(coverage): apply always_strict to test262 and typescript per the specifcation (#5555)
This also removes the confusing `SourceType::always_strict` field.

I hacked it with `SourceType::always_strict`, but what we actually want is add `'use strict'`.

This is technically a breaking change but I don't expect anyone using this outside of oxc.

The snapshot has a large diff due to every single line shifting by 1 row :-/
2024-09-06 17:14:01 +00:00
Boshen
1bed5ce2a5 chore: run cargo +nightly fmt to sort imports (#5503)
They are never going to be stable are they ... cedf7a4daa/.rustfmt.toml (L8-L16)
2024-09-06 04:04:26 +00:00
dalaoshu
4473779074
feat(linter/node): implement no-exports-assign (#5370) 2024-09-03 07:53:14 -04:00
Boshen
2fbc283e03
chore: bump rustc to v1.80.1 (#5211) 2024-08-26 13:11:29 +08:00
Boshen
56cc4818b5
chore(website): remove textlint annotation
the website no longer uses textlint
2024-08-23 15:50:52 +08:00
DonIsaac
7c6bae2d65 feat(website): add link to rule source on docs page (#4995)
![image](https://github.com/user-attachments/assets/70e02c73-5d28-443e-91b0-f32d0623a1ca)
2024-08-19 20:40:14 +00:00
Don Isaac
a0effab160
feat(linter): support more flexible config.globals values (#4990)
Support `"readable", `"writable"`, and boolean values for `GlobalValue`.

I also enhanced the documentation for `OxcGlobals`

## Screenshot
<img width="797" alt="image"
src="https://github.com/user-attachments/assets/8f76de4c-4ae8-44d1-9be1-720fc3c7e0ec">
2024-08-19 16:23:47 -04:00
Don Isaac
4436774e8c
fix(website): sanitize JSON in section docs (#4989) 2024-08-19 16:23:31 -04:00
Boshen
5b14608a95
chore(tasks/website): do not run textlint nor prettier 2024-08-15 14:28:57 +08:00
mysteryven
4d28d037e6 feat(task/website): support render subschemas.all_of (#4800)
To solve unexpected snapshot update in #4742  : https://github.com/oxc-project/oxc/pull/4742/files#diff-4c1a03dc03cfd00f9eaecb5c66b61f4e57272c6262253f0dc82ea1b71223bac2
2024-08-14 06:12:03 +00:00
Boshen
955a4b4479
docs(oxlint): improve cli doc regarding fix and -D all
closes #3944
2024-08-12 14:58:12 +08:00
Boshen
505d39ba0a
chore: bump deps 2024-08-12 10:12:34 +08:00
Don Isaac
cc922f4c89
feat(vscode): provide config's schema to oxlint config files (#4826)
Updates the VSCode plugin client to automatically provide our
auto-generated
JSON schema to `\.?oxlint(rc)?(\.json)?` files.
2024-08-12 09:15:47 +08:00
DonIsaac
3d40528588 feat(linter): add fix emoji to rules table and doc pages (#4715)
Rules table:
<img width="898" alt="image" src="https://github.com/user-attachments/assets/353052aa-0af3-4c09-8441-ff79f4561ca0">

Doc pages:
<img width="918" alt="image" src="https://github.com/user-attachments/assets/cb43cb2d-15ff-41e6-8523-145cfbc3f484">
2024-08-10 22:50:47 +00:00
DonIsaac
8f2a566f9f test(linter): ensure rule docs have valid syntax (#4644)
Adds tests for rule documentation by
1. Compiling doc markdown into HTML, which ensures docs use valid markdown syntax
2. Converts the generated HTML into JSX and parses the results with the parser, ensuring the generated HTML is valid

Has the added benefit of adding a lot of JSX test cases to the parser. I've also fixed all violations for these tests in this PR.
2024-08-10 05:03:09 +00:00
DonIsaac
f62951411d feat(website): auto-generate rule docs pages (#4640)
> AI-generated description because I'm lazy
### TL;DR

This PR introduces the ability to generate documentation for linter rules and adds new methods and metadata for rule fix capabilities.

To see what this looks like, please check out https://github.com/oxc-project/oxc-project.github.io/pull/165.

## Screenshots
Hyperlinks to rule doc pages in auto-generated rules table
<img width="809" alt="image" src="https://github.com/user-attachments/assets/e09eb47d-e86a-4ed1-b1f9-5034f33c71a2">

Example of a docs page
<img width="1273" alt="image" src="https://github.com/user-attachments/assets/78f7e9e6-f4dd-4cc9-aebc-1cdd64b024ec">

### What changed?

- Added `RuleFixMeta` to indicate rule fix capabilities
- Introduced methods `is_none` and `is_pending` in `RuleFixMeta`
- Modified `render_markdown_table` in `RuleTableSection` to accept an optional link prefix
- Created new modules for rule documentation and HTML rendering
- Updated `print_rules` function to generate markdown for rules and detailed documentation pages

### How to test?

Run the `linter-rules` task with appropriate arguments to generate the markdown table and documentation pages.
Verify the generated files for correctness and that all metadata is correctly displayed.

### Why make this change?

To enhance the project documentation and provide clear rule fix capabilities, thereby improving the developer experience and easing the integration process.

---
2024-08-10 00:13:06 +00:00
DonIsaac
7afa1f06c3 feat(linter): support suggestions and dangerous fixes (#4223) 2024-07-18 02:20:30 +00:00
Jelle van der Waa
1f8968a521
feat(linter): Add eslint-plugin-promise rules: avoid-new, no-new-statics, params-names (#4293)
This introduces the `eslint-plugin-promise` plugin and implements three
relatively simple rules.

Split off from https://github.com/oxc-project/oxc/pull/4252
2024-07-17 09:21:20 +08:00
Boshen
83bd40db4e
chore: turn off doctest for all [[bin]] 2024-07-14 16:55:19 +08:00
mysteryven
328445b4ca feat(linter): support vitest/no-disabled-tests (#3717) 2024-06-24 15:16:32 +00:00
Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt 2024-06-19 00:48:30 +08:00
Boshen
1c7f19c868 chore(oxlint): remove unused code (format command) (#3716) 2024-06-17 12:16:21 +00:00
Boshen
982e6f08df chore: make println and eprintln opt-in (#3712)
I noticed accidental `println` can be merged, which isn't really nice.
2024-06-17 10:40:34 +00:00
Boshen
dd42f279f7
chore: change website url to https://oxc.rs 2024-06-05 22:05:08 +08:00
Boshen
570b234a70
chore(transformers): switch crate browserslist-rs to oxc-browserslist 2024-05-28 10:49:49 +08:00
Boshen
19bb1c02f2 fix(website): hack schemars to render code snippet in markdown (#3417) 2024-05-26 10:36:53 +00:00
Boshen
21505e885c refactor(cli): move crates/oxc_cli to apps/oxlint (#3413)
We need to split the cli crate up to reduce dependencies,
the current cli crate is pulling in `oxc_prettier`, which is redundant
for the linter.
2024-05-26 05:00:30 +00:00
Boshen
9377a60677
chore(linter): write json schema to npm/oxlint 2024-05-24 13:28:03 +08:00
Boshen
5bf595d6f7
refactor(linter): rename variable names prefix ESLint to Oxlint 2024-05-24 12:58:27 +08:00
Boshen
809e4fc03f
chore(website): snapshot cli and json schema output 2024-05-24 12:23:43 +08:00
Boshen
ff4252a201
feat(website): improve codegen to linter cli 2024-05-23 20:57:13 +08:00
Boshen
3671b5c4d0
feat(tasks/website): code generate the linter rules 2024-05-23 15:21:37 +08:00
Boshen
ead637bf50
feat(website): generate linter configuration page 2024-05-23 12:07:17 +08:00
Boshen
57d2bcacea feat(tasks/website): start generating linter config markdown from json schema (#3386) 2024-05-22 16:09:33 +00:00
Boshen
e2dd8ac8fc feat(syntax): export is_reserved_keyword and is_global_object method (#3384) 2024-05-22 04:58:04 +00:00
Boshen
40ab95b055 feat(tasks): add website tasks (#3377)
Adds the following tasks so we can use them in the website repo to generate documentations.

`cargo run -p website`
* linter-cli
* linter-rules
* linter-json-schema
2024-05-21 17:46:07 +00:00