@redproof/eslint 0.0.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @redproof/eslint
|
|
2
|
+
|
|
3
|
+
Redproof adapter for ESLint. It turns ESLint rules into Redproof Rules, so you can prove each one really fails when it should.
|
|
4
|
+
|
|
5
|
+
Part of [Redproof](https://github.com/schalermthai/redproof). Redproof does not
|
|
6
|
+
just run your guardrails. It proves they can fail.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install --save-dev @redproof/eslint redproof eslint
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Use
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// gates/eslint.ts
|
|
18
|
+
import { eslint } from '@redproof/eslint';
|
|
19
|
+
import { defineGate, defineProofs, mutate, proof } from 'redproof';
|
|
20
|
+
|
|
21
|
+
const adapter = eslint({
|
|
22
|
+
files: ['src/**/*.js'],
|
|
23
|
+
rules: {
|
|
24
|
+
noConsole: 'no-console',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const gate = defineGate({ id: 'eslint', adapter });
|
|
29
|
+
|
|
30
|
+
export const proofs = defineProofs(gate, [
|
|
31
|
+
proof.red(
|
|
32
|
+
adapter.rules.noConsole,
|
|
33
|
+
'detects console usage',
|
|
34
|
+
mutate.appendText('src/clean.js', '\nconsole.log(1);\n'),
|
|
35
|
+
),
|
|
36
|
+
proof.green('accepts clean source'),
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
export default gate;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then run:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx redproof check # do the rules hold right now?
|
|
46
|
+
npx redproof prove # can each rule actually fail?
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
See the [Redproof documentation](https://github.com/schalermthai/redproof#readme).
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redproof/eslint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Redproof adapter for ESLint rules.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"default": "./dist/index.js"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
12
13
|
"files": [
|
|
13
14
|
"dist"
|
|
14
15
|
],
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
"node": ">=22.6"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"redproof": "0.
|
|
20
|
+
"redproof": "0.6.0"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"eslint": ">=9"
|