Skip to content

Commit 6c6edc4

Browse files
committed
chore: resolve remarks
1 parent 0d66211 commit 6c6edc4

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

lib/create-testing-library-rule/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export function createTestingLibraryRule<
3434
...meta,
3535
docs: {
3636
...meta.docs,
37+
// We're using our own recommendedConfig meta to tell our build tools
38+
// if the rule is recommended on a config basis
3739
recommended: false,
3840
},
3941
},

lib/utils/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ type TestingLibraryRuleMetaDocs<TOptions extends readonly unknown[]> = Omit<
1010
TSESLint.RuleMetaDataDocs,
1111
'recommended' | 'url'
1212
> & {
13+
/**
14+
* The recommendation level for the rule on a framework basis.
15+
* Used by the build tools to generate the framework config.
16+
* Set to false to not include it the config
17+
*/
1318
recommendedConfig: Record<
1419
SupportedTestingFramework,
1520
RecommendedConfig<TOptions>

tests/__snapshots__/index.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`should export configs that refer to actual rules 1`] = `
3+
exports[`should have run 'generate:configs' script when changing config rules 1`] = `
44
Object {
55
"angular": Object {
66
"plugins": Array [

tests/index.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import { exec } from 'child_process';
12
import { existsSync } from 'fs';
23
import { resolve } from 'path';
34

45
import plugin from '../lib';
56

7+
const generateConfigs = () => exec(`npm run generate:configs`);
8+
69
const numberOfRules = 24;
710
const ruleNames = Object.keys(plugin.rules);
811

@@ -43,10 +46,16 @@ it('should have the correct amount of rules', () => {
4346
}
4447
});
4548

49+
it("should have run 'generate:configs' script when changing config rules", async () => {
50+
await generateConfigs();
51+
52+
const allConfigs = plugin.configs;
53+
expect(allConfigs).toMatchSnapshot();
54+
});
55+
4656
it('should export configs that refer to actual rules', () => {
4757
const allConfigs = plugin.configs;
4858

49-
expect(allConfigs).toMatchSnapshot();
5059
expect(Object.keys(allConfigs)).toEqual(['dom', 'angular', 'react', 'vue']);
5160
const allConfigRules = Object.values(allConfigs)
5261
.map((config) => Object.keys(config.rules))

0 commit comments

Comments
 (0)