Skip to content

Commit

Permalink
configure testsDir to {spec,test,tests} by default
Browse files Browse the repository at this point in the history
  • Loading branch information
falkenhawk committed Jul 10, 2024
1 parent 240fa64 commit a1d2ce1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ The upgrade to ESLint v9 and typescript-eslint v7 is planned for the next major
to avoid `Parsing error (...) TSConfig does not include this file`. [read more »](https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file)
Example: `['dangerfile.ts', '.storybook/*.ts?(x)']`
- `indent` (default: `2`): number of spaces to use for indentation or `tab` for tabs
- `testsDir` (default: `spec`): directory where test files are located. Can be also configured as `{spec,tests}` to include multiple directories.
- `testsDir` (default: `{spec,test,tests}`): directory where test files are located.
Example: `src` for single directory, `{spec,tests}` to include multiple directories.
In addition, files in `__tests__` folders and files with `*.spec.*`/`*.test.*` filenames are picked up as test files, even outside of `testsDir`.
- `cypress` (default: `false`): enable Cypress-specific rules
- `jest` (default: `false`): enable Jest-specific rules
Expand Down
8 changes: 4 additions & 4 deletions eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type CustomizeOptions = {
disableTypeChecked?: string[];
// Number of spaces to use for indentation, or 'tab' to use tabs (default: 2)
indent?: number | 'tab';
// Directory where test files are located. (default: `spec`)
// Can be also configured as `{spec,tests}` to include multiple directories.
// Directory where test files are located. (default: `{spec,test,tests}`)
// Example: `src` for single directory, `{spec,tests}` to include multiple directories.
// In addition, files in `__tests__` folders and files with `*.spec.*`/`*.test.*` filenames are picked up as test files, even outside of `testsDir`.
testsDir?: string;
// Whether to enable Cypress-specific rules. (default: false)
Expand All @@ -44,7 +44,7 @@ const shared: Linter.RulesRecord = {
* @param {'ban' | 'ban-log' | 'allow'} [options.console] - Whether to ban or allow console usage. Defaults to 'ban-log' (which allows 'console.error()', 'console.warn()' and 'console.info()') when 'react': true, 'allow' otherwise.
* @param {string[]} [options.disableTypeChecked] - List ts files which should be linted, but are not covered by tsconfig.json to avoid 'Parsing error (...) TSConfig does not include this file' https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
* @param {number | 'tab'} [options.indent=2] - Number of spaces to use for indentation, or 'tab' to use tabs.
* @param {string} [options.testsDir=spec] - Directory where test files are located. Can be also configured as `{spec,tests}` to include multiple directories. In addition, files in `__tests__` folders and files with `*.spec.*`/`*.test.*` filenames are picked up as test files, even outside of `testsDir`.
* @param {string} [options.testsDir={spec,test,tests}] - Directory where test files are located. Example: `src` for single directory, `{spec,tests}` to include multiple directories. In addition, files in `__tests__` folders and files with `*.spec.*`/`*.test.*` filenames are picked up as test files, even outside of `testsDir`.
* @param {boolean} [options.cypress=false] - Whether to enable Cypress-specific rules.
* @param {boolean} [options.jest=false] - Whether to enable Jest-specific rules.
* @param {boolean} [options.mocha=false] - Whether to enable Mocha-specific rules.
Expand All @@ -56,7 +56,7 @@ function customize(options: CustomizeOptions = {}) {
const {
disableTypeChecked = [],
indent = 2,
testsDir = 'spec',
testsDir = '{spec,test,tests}',
cypress = false,
jest = false,
mocha = false,
Expand Down

0 comments on commit a1d2ce1

Please sign in to comment.