Skip to content

Commit 5433e0e

Browse files
committed
🧪 add basic tests
1 parent 0453b93 commit 5433e0e

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root: true
2+
extends:
3+
- '@dudeofawesome'
4+
- '@dudeofawesome/react'
5+
parserOptions:
6+
ecmaVersion: 2022

‎eslint-config-react/test/index.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { describe, it } from 'node:test';
2+
import { ESLint } from 'eslint';
3+
import {
4+
testRuleFail,
5+
testNoFail,
6+
defaultTestSet,
7+
} from '../../utils/testing/eslint';
8+
9+
const linter = new ESLint({ cwd: __dirname });
10+
11+
describe('eslint-config-react', () => {
12+
defaultTestSet(linter);
13+
14+
describe('passes', () => {
15+
it(`should pass radix`, async () =>
16+
testNoFail({
17+
linter,
18+
code: `parseInt('10');\n`,
19+
file_path: 'index.jsx',
20+
}));
21+
});
22+
23+
describe('fails', () => {
24+
it(`should fail radix`, async () =>
25+
testRuleFail({
26+
linter,
27+
code: `parseInt('10');\n`,
28+
ruleId: 'radix',
29+
file_path: 'index.jsx',
30+
}));
31+
32+
it(`should fail no-console`, () =>
33+
testRuleFail({
34+
linter,
35+
code: `console.log('foo');\n`,
36+
ruleId: 'no-console',
37+
file_path: 'index.jsx',
38+
}));
39+
});
40+
});

0 commit comments

Comments
 (0)