Commit graph

57 commits

Author SHA1 Message Date
Alexander S.
9558087db9
feat(oxlint): auto detect config file in CLI (#7348)
waiting fior #7352

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-23 23:17:05 +08:00
DonIsaac
df143ca7bb docs(linter): add docs for config settings (#4827) 2024-11-21 08:08:30 +00:00
Alexander S.
d3a0119a42
feat(oxlint): add cwd property to LintRunner (#7352)
allows to use multiple `LintRunner` in one file targeting multiple
directory.
The current problem is for the test in #7348 we can not change
`env::current_dir`,
so as a workaround I introduce a new property :) 

See more info here:
https://discord.com/channels/1079625926024900739/1117322804291964931/1308179827576016897
2024-11-20 12:44:50 +08:00
Nicholas Rayburn
7b7555a0ab
docs(website): Link to specific ref when generating website docs (#7324)
Currently the website links to main which is subject to change without
an update to the website. This updates the website to link to the
specific commit that was used when the website was published.

Feel free to cleanup anything in this PR.
2024-11-17 14:23:00 +08:00
DonIsaac
2268a0ef90 feat(linter): support overrides config field (#6974)
Part of #5653
2024-11-13 05:40:59 +00:00
Boshen
50646a49ea refactor(tasks/website): remove scraper dependency (#7116) 2024-11-04 14:16:11 +00:00
Dmitry Zakharov
3923e63b61
docs(linter): add schema to config examples (#6838)
closes #6762
2024-10-24 08:44:04 +08:00
mysteryven
0acca58581 feat(linter): support --print-config all to print config file for project (#6579)
Continue work on #4742.

Only `oxlint --print-config all` is supported. It's useful to migrate from command-line interface to config file.

The `--print-config PATH` looks not really useful for us now, I will add it after config file overrides supported.
2024-10-22 17:56:23 +00:00
DonIsaac
5213ba7fb4 feat(website/linter): render mapped types in config docs (#6604)
Render better types for config properties that accept arbitrary keys. For example, `Record<string, boolean>` instead of `object`.
2024-10-15 20:35:45 +00:00
DonIsaac
dcd4607a40 feat(website/linter): render defaults in config docs (#6603)
Render default values for each section in oxlintrc config docs.
2024-10-15 20:35:45 +00:00
DonIsaac
d4cb7e6f58 fix(website/linter): better md rendering for primitive arrays (#6602)
Improves how config docs are rendered for the website. If a config property is an array of primitive values, we now skip subsection rendering and render a better type, e.g. `string[]` instead of `array`.
2024-10-15 20:35:45 +00:00
Boshen
591f5dd960 chore(deps): update rust crates (#6542) 2024-10-14 03:14:15 +00:00
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