-
Notifications
You must be signed in to change notification settings - Fork 150
refactor: automatically generate all configs #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Belco90
merged 11 commits into
testing-library:main
from
MichaelDeBoey:generate-configs
Apr 29, 2021
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
50c2d90
refactor: extract configs into their own files
MichaelDeBoey e27403f
chore: add generate-configs script
MichaelDeBoey 66fc380
fix: make rules comply with TestingLibraryRuleMeta
MichaelDeBoey 682fd59
chore: automatically generate all configs
MichaelDeBoey 65f208b
refactor: use recommendedConfig instead of recommended in meta docs
MichaelDeBoey 6a85121
fix: add prefix in front of rule names in configs
MichaelDeBoey 0d66211
test: fix createTestingLibraryRule test
MichaelDeBoey 6c6edc4
chore: resolve remarks
MichaelDeBoey d934d89
chore: reference running scripts via npm instead of yarn
MichaelDeBoey acad7e2
chore: don't warn on unused variables beginning with _
MichaelDeBoey ab3b462
docs(CONTRIBUTING): add some explanation about recommendedConfig
MichaelDeBoey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,21 @@ | ||
// THIS CODE WAS AUTOMATICALLY GENERATED | ||
// DO NOT EDIT THIS CODE BY HAND | ||
// YOU CAN REGENERATE IT USING npm run generate:configs | ||
|
||
export = { | ||
plugins: ['testing-library'], | ||
rules: { | ||
'testing-library/await-async-query': 'error', | ||
'testing-library/await-async-utils': 'error', | ||
'testing-library/no-await-sync-query': 'error', | ||
'testing-library/no-container': 'error', | ||
'testing-library/no-debug': 'error', | ||
'testing-library/no-dom-import': ['error', 'angular'], | ||
'testing-library/no-node-access': 'error', | ||
'testing-library/no-promise-in-fire-event': 'error', | ||
'testing-library/no-wait-for-empty-callback': 'error', | ||
'testing-library/prefer-find-by': 'error', | ||
'testing-library/prefer-screen-queries': 'error', | ||
'testing-library/render-result-naming-convention': 'error', | ||
}, | ||
}; |
This file contains hidden or 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,16 @@ | ||
// THIS CODE WAS AUTOMATICALLY GENERATED | ||
// DO NOT EDIT THIS CODE BY HAND | ||
// YOU CAN REGENERATE IT USING npm run generate:configs | ||
|
||
export = { | ||
plugins: ['testing-library'], | ||
rules: { | ||
'testing-library/await-async-query': 'error', | ||
'testing-library/await-async-utils': 'error', | ||
'testing-library/no-await-sync-query': 'error', | ||
'testing-library/no-promise-in-fire-event': 'error', | ||
'testing-library/no-wait-for-empty-callback': 'error', | ||
'testing-library/prefer-find-by': 'error', | ||
'testing-library/prefer-screen-queries': 'error', | ||
}, | ||
}; |
This file contains hidden or 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,24 @@ | ||
import { join } from 'path'; | ||
|
||
import type { TSESLint } from '@typescript-eslint/experimental-utils'; | ||
|
||
import { | ||
importDefault, | ||
SUPPORTED_TESTING_FRAMEWORKS, | ||
SupportedTestingFramework, | ||
} from '../utils'; | ||
|
||
export type LinterConfigRules = Record<string, TSESLint.Linter.RuleEntry>; | ||
|
||
const configsDir = __dirname; | ||
|
||
const getConfigForFramework = (framework: SupportedTestingFramework) => | ||
importDefault<LinterConfigRules>(join(configsDir, framework)); | ||
|
||
export default SUPPORTED_TESTING_FRAMEWORKS.reduce( | ||
(allConfigs, framework) => ({ | ||
...allConfigs, | ||
[framework]: getConfigForFramework(framework), | ||
}), | ||
{} | ||
) as Record<SupportedTestingFramework, LinterConfigRules>; |
This file contains hidden or 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,21 @@ | ||
// THIS CODE WAS AUTOMATICALLY GENERATED | ||
// DO NOT EDIT THIS CODE BY HAND | ||
// YOU CAN REGENERATE IT USING npm run generate:configs | ||
|
||
export = { | ||
plugins: ['testing-library'], | ||
rules: { | ||
'testing-library/await-async-query': 'error', | ||
'testing-library/await-async-utils': 'error', | ||
'testing-library/no-await-sync-query': 'error', | ||
'testing-library/no-container': 'error', | ||
'testing-library/no-debug': 'error', | ||
'testing-library/no-dom-import': ['error', 'react'], | ||
'testing-library/no-node-access': 'error', | ||
'testing-library/no-promise-in-fire-event': 'error', | ||
'testing-library/no-wait-for-empty-callback': 'error', | ||
'testing-library/prefer-find-by': 'error', | ||
'testing-library/prefer-screen-queries': 'error', | ||
'testing-library/render-result-naming-convention': 'error', | ||
}, | ||
}; |
This file contains hidden or 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 @@ | ||
// THIS CODE WAS AUTOMATICALLY GENERATED | ||
// DO NOT EDIT THIS CODE BY HAND | ||
// YOU CAN REGENERATE IT USING npm run generate:configs | ||
|
||
export = { | ||
plugins: ['testing-library'], | ||
rules: { | ||
'testing-library/await-async-query': 'error', | ||
'testing-library/await-async-utils': 'error', | ||
'testing-library/await-fire-event': 'error', | ||
'testing-library/no-await-sync-query': 'error', | ||
'testing-library/no-container': 'error', | ||
'testing-library/no-debug': 'error', | ||
'testing-library/no-dom-import': ['error', 'vue'], | ||
'testing-library/no-node-access': 'error', | ||
'testing-library/no-promise-in-fire-event': 'error', | ||
'testing-library/no-wait-for-empty-callback': 'error', | ||
'testing-library/prefer-find-by': 'error', | ||
'testing-library/prefer-screen-queries': 'error', | ||
'testing-library/render-result-naming-convention': 'error', | ||
}, | ||
}; |
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -1,61 +1,7 @@ | ||
import configs from './configs'; | ||
import rules from './rules'; | ||
|
||
const domRules = { | ||
'testing-library/await-async-query': 'error', | ||
'testing-library/await-async-utils': 'error', | ||
'testing-library/no-await-sync-query': 'error', | ||
'testing-library/no-promise-in-fire-event': 'error', | ||
'testing-library/no-wait-for-empty-callback': 'error', | ||
'testing-library/prefer-find-by': 'error', | ||
'testing-library/prefer-screen-queries': 'error', | ||
}; | ||
|
||
const angularRules = { | ||
...domRules, | ||
'testing-library/no-container': 'error', | ||
'testing-library/no-debug': 'error', | ||
'testing-library/no-dom-import': ['error', 'angular'], | ||
'testing-library/no-node-access': 'error', | ||
'testing-library/render-result-naming-convention': 'error', | ||
}; | ||
|
||
const reactRules = { | ||
...domRules, | ||
'testing-library/no-container': 'error', | ||
'testing-library/no-debug': 'error', | ||
'testing-library/no-dom-import': ['error', 'react'], | ||
'testing-library/no-node-access': 'error', | ||
'testing-library/render-result-naming-convention': 'error', | ||
}; | ||
|
||
const vueRules = { | ||
...domRules, | ||
'testing-library/await-fire-event': 'error', | ||
'testing-library/no-container': 'error', | ||
'testing-library/no-debug': 'error', | ||
'testing-library/no-dom-import': ['error', 'vue'], | ||
'testing-library/no-node-access': 'error', | ||
'testing-library/render-result-naming-convention': 'error', | ||
}; | ||
|
||
export = { | ||
configs, | ||
rules, | ||
configs: { | ||
dom: { | ||
plugins: ['testing-library'], | ||
rules: domRules, | ||
}, | ||
angular: { | ||
plugins: ['testing-library'], | ||
rules: angularRules, | ||
}, | ||
react: { | ||
plugins: ['testing-library'], | ||
rules: reactRules, | ||
}, | ||
vue: { | ||
plugins: ['testing-library'], | ||
rules: vueRules, | ||
}, | ||
}, | ||
}; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.