-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the first version released after forking the [customisation] of the [original project]. * Scan specific directories ([631], [647]) * Scan directories configured by `files.include` ([635], [645]) * Fix handling of the configuration `files.exclude` ([635], [646]) * Support disabling rules in souces using `eslint-disable` ([630], [642]) * Support including and excluding rules in the `lint` method ([631], [643]) * Execute the command-line tool `denolint` without loading the Node.js VM ([648]) * Allow specifying directories, files and patterns as input for checking [customisation]: https://github.com/prantlf/node-rs/commits/combined [original project]: https://github.com/napi-rs/node-rs/tree/main/packages/deno-lint [630]: napi-rs/node-rs#630 [631]: napi-rs/node-rs#631 [635]: napi-rs/node-rs#635 [642]: napi-rs/node-rs#642 [643]: napi-rs/node-rs#643 [645]: napi-rs/node-rs#645 [646]: napi-rs/node-rs#646 [647]: napi-rs/node-rs#647 [648]: napi-rs/node-rs#648
- Loading branch information
0 parents
commit 21f0f1f
Showing
48 changed files
with
4,495 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
crates | ||
node_modules | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
parser: '@typescript-eslint/parser' | ||
|
||
parserOptions: | ||
ecmaVersion: 2020 | ||
sourceType: module | ||
|
||
env: | ||
browser: true | ||
es6: true | ||
node: true | ||
|
||
plugins: | ||
- import | ||
|
||
extends: | ||
- eslint:recommended | ||
- plugin:prettier/recommended |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
Cargo.lock | ||
*.log | ||
node_modules | ||
packages/*/npm | ||
packages/denolint/denolint | ||
packages/libdenolint/index.d.ts | ||
packages/libdenolint/libdenolint.node | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
pnpx lint-staged && cargo fmt --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.d.ts | ||
crates | ||
node_modules | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "js tests", | ||
"type": "node", | ||
"request": "launch", | ||
"program": "${file}", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
] | ||
}, | ||
{ | ||
"name": "executable", | ||
"type": "lldb", | ||
"request": "launch", | ||
"cargo": { | ||
"args": ["build", "--bin=denolint", "--package=denolint"], | ||
"filter": { | ||
"name": "denolint", | ||
"kind": "bin" | ||
} | ||
}, | ||
"args": ["crates/shared/test/fail/ultimate2.js"], | ||
"cwd": "${workspaceFolder}" | ||
}, | ||
{ | ||
"name": "rust tests", | ||
"type": "lldb", | ||
"request": "launch", | ||
"cargo": { | ||
"args": ["test", "--no-run", "--bin=denolint", "--package=denolint"], | ||
"filter": { | ||
"name": "denolint", | ||
"kind": "bin" | ||
} | ||
}, | ||
"args": [], | ||
"cwd": "${workspaceFolder}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.DS_Store": true, | ||
"packages/denolint/denolint": true, | ||
"packages/**/*/*.node": true | ||
}, | ||
"search.exclude": { | ||
"**/node_modules": true, | ||
"**/npm": true, | ||
"**/target": true, | ||
"packages/libdenolint/index.d.ts": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cargo-features = ["strip"] | ||
|
||
[workspace] | ||
members = ["./packages/denolint", "./packages/libdenolint"] | ||
|
||
[profile.release] | ||
codegen-units = 4 | ||
lto = true | ||
overflow-checks = false | ||
strip = 'symbols' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020-2022 LongYinan | ||
Copyright (c) 2022 Ferdinand Prantl | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# denolint | ||
|
||
> Monorepo for calling `deno lint` in Node.js projects using the Rust package [deno_lint]. | ||
This project started as fork of a [customised @node-rs/deno-lint], adding the flexibility of `eslint`: | ||
|
||
* Scan specific directories ([631], [647]) | ||
* Scan directories configured by `files.include` ([635], [645]) | ||
* Fix handling of the configuration `files.exclude` ([635], [646]) | ||
* Support disabling rules in souces using `eslint-disable` ([630], [642]) | ||
* Support including and excluding rules in the `lint` method ([631], [643]) | ||
* Execute the command-line tool `denolint` without loading the Node.js VM ([648]) | ||
* Offer both synchronous and asynchronous methods ([650]) | ||
* Allow specifying directories, files and patterns as input for checking | ||
|
||
## Synopsis | ||
|
||
Scan sources in two directories on the command line: | ||
|
||
npx denolint src test | ||
|
||
Check one source file programmatically: | ||
|
||
```js | ||
import { readFile } from 'fs/promises' | ||
import { lint } from 'libdenolint' | ||
|
||
const filepath = 'src/index.js' | ||
const source = await readFile(filepath) | ||
|
||
const warnings = await lint(filepath, source) | ||
for (const warning of warnings) console.warn(warning) | ||
``` | ||
|
||
## Packages | ||
|
||
See more information about the packages and their compatibility with [@node-rs/deno-lint]: | ||
|
||
| Project | Package | Description | | ||
| ------------- | ------------------------------------------------------------------- | --------------------------------------------- | | ||
| [denolint] | [![denolint](https://img.shields.io/npm/v/denolint.svg)][cmd] | Deno lint command-line executable for Node.js | | ||
| [libdenolint] | [![libdenolint](https://img.shields.io/npm/v/libdenolint.svg)][lib] | Deno lint library binding for Node.js | | ||
|
||
## Support matrix | ||
|
||
| Platform | node14 | node16 | node18 | | ||
| ---------------- | ------ | ------ | ------ | | ||
| Windows x64 | ✓ | ✓ | ✓ | | ||
| Windows x32 | ✓ | ✓ | ✓ | | ||
| Windows arm64 | ✓ | ✓ | ✓ | | ||
| MacOS x64 | ✓ | ✓ | ✓ | | ||
| MacOS arm64 | ✓ | ✓ | ✓ | | ||
| Linux x64 gnu | ✓ | ✓ | ✓ | | ||
| Linux x64 musl | ✓ | ✓ | ✓ | | ||
| Linux arm gnu | ✓ | ✓ | ✓ | | ||
| Linux arm64 gnu | ✓ | ✓ | ✓ | | ||
| Linux arm64 musl | ✓ | ✓ | ✓ | | ||
| Android arm64 | ✓ | ✓ | ✓ | | ||
| Android armv7 | ✓ | ✓ | ✓ | | ||
| FreeBSD x64 | ✓ | ✓ | ✓ | | ||
|
||
[deno_lint]: https://github.com/denoland/deno_lint | ||
[customised @node-rs/deno-lint]: https://github.com/prantlf/node-rs/commits/combined | ||
[@node-rs/deno-lint]: https://github.com/napi-rs/node-rs/tree/main/packages/deno-lint | ||
[denolint]: https://github.com/prantlf/denolint/tree/master/packages/denolint | ||
[cmd]: https://www.npmjs.com/package/denolint | ||
[libdenolint]: https://github.com/prantlf/denolint/tree/master/packages/libdenolint | ||
[lib]: https://www.npmjs.com/package/libdenolint | ||
[630]: https://github.com/napi-rs/node-rs/issues/630 | ||
[631]: https://github.com/napi-rs/node-rs/issues/631 | ||
[635]: https://github.com/napi-rs/node-rs/issues/635 | ||
[642]: https://github.com/napi-rs/node-rs/pull/642 | ||
[643]: https://github.com/napi-rs/node-rs/pull/643 | ||
[645]: https://github.com/napi-rs/node-rs/pull/645 | ||
[646]: https://github.com/napi-rs/node-rs/pull/646 | ||
[647]: https://github.com/napi-rs/node-rs/pull/647 | ||
[648]: https://github.com/napi-rs/node-rs/issues/648 | ||
[650]: https://github.com/napi-rs/node-rs/issues/650 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "global_alloc" | ||
version = "1.0.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[target.'cfg(not(target_os = "linux"))'.dependencies] | ||
mimalloc-rust = { version = "0.2" } | ||
|
||
[target.'cfg(all(target_os = "linux", not(all(target_env = "musl", target_arch = "aarch64"))))'.dependencies] | ||
mimalloc-rust = { version = "0.2", features = ["local-dynamic-tls"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#[cfg(all( | ||
not(all(target_os = "linux", target_env = "musl", target_arch = "aarch64")), | ||
not(debug_assertions) | ||
))] | ||
#[global_allocator] | ||
static ALLOC: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "shared" | ||
version = "1.0.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["lib"] | ||
|
||
[dependencies] | ||
deno_ast = "0.19.0" | ||
deno_lint = "0.33.0" | ||
ignore = "0.4.18" | ||
miette = { version = "5.3.0", features = ["fancy-no-backtrace"] } | ||
serde = "1.0.145" | ||
serde_json = "1.0.85" |
Oops, something went wrong.