@open-turo/eslint-config-react 14.0.2 → 14.0.4
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/.pre-commit-config.yaml +1 -1
- package/pack/open-turo-eslint-config-react-14.0.4.tgz +0 -0
- package/package.json +6 -5
- package/test/__snapshots__/legacy.spec.js.snap +2929 -0
- package/test/__snapshots__/test.spec.js.snap +3410 -0
- package/test/legacy.spec.js +30 -0
- package/test/sample.ts +0 -0
- package/test/test.spec.js +30 -0
- package/pack/open-turo-eslint-config-react-14.0.2.tgz +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const { ESLint } = require("eslint");
|
|
3
|
+
|
|
4
|
+
describe("validate config", () => {
|
|
5
|
+
it(`Legacy - load config file in ESLint to validate all rules are correct`, async () => {
|
|
6
|
+
const stringConfig = fs.readFileSync("./test/sample.ts", "utf8");
|
|
7
|
+
|
|
8
|
+
const cli = new ESLint({
|
|
9
|
+
overrideConfigFile: "./legacy.js",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const calculatedConfig =
|
|
13
|
+
await cli.calculateConfigForFile("./test/sample.ts");
|
|
14
|
+
|
|
15
|
+
// remove parser property from calculated config because it is env specific (fails in CI)
|
|
16
|
+
const { parser, ...calculatedConfigWithoutParserProperty } =
|
|
17
|
+
calculatedConfig;
|
|
18
|
+
// print all the rules
|
|
19
|
+
expect(calculatedConfigWithoutParserProperty).toMatchSnapshot();
|
|
20
|
+
|
|
21
|
+
const lintResult = await cli.lintText(stringConfig);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* We just need to validate a value is returned.
|
|
25
|
+
* If there is an issue with the config, `cli.lintText` will error,
|
|
26
|
+
* and we will never hit this line so the test will fail.
|
|
27
|
+
*/
|
|
28
|
+
expect(lintResult).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
});
|
package/test/sample.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const { ESLint } = require("eslint");
|
|
3
|
+
|
|
4
|
+
describe("validate config", () => {
|
|
5
|
+
it(`load config file in ESLint to validate all rules are correct`, async () => {
|
|
6
|
+
const stringConfig = fs.readFileSync("./test/sample.ts", "utf8");
|
|
7
|
+
|
|
8
|
+
const cli = new ESLint({
|
|
9
|
+
overrideConfigFile: "./index.js",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const calculatedConfig =
|
|
13
|
+
await cli.calculateConfigForFile("./test/sample.ts");
|
|
14
|
+
|
|
15
|
+
// remove parser property from calculated config because it is env specific (fails in CI)
|
|
16
|
+
const { parser, ...calculatedConfigWithoutParserProperty } =
|
|
17
|
+
calculatedConfig;
|
|
18
|
+
// print all the rules
|
|
19
|
+
expect(calculatedConfigWithoutParserProperty).toMatchSnapshot();
|
|
20
|
+
|
|
21
|
+
const lintResult = await cli.lintText(stringConfig);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* We just need to validate a value is returned.
|
|
25
|
+
* If there is an issue with the config, `cli.lintText` will error,
|
|
26
|
+
* and we will never hit this line so the test will fail.
|
|
27
|
+
*/
|
|
28
|
+
expect(lintResult).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
Binary file
|