-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: eslint-config cypress and storybook definitions fixes
- Loading branch information
Showing
11 changed files
with
84 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,43 +1,3 @@ | ||
import type { Linter } from 'eslint'; | ||
import { cypressPreset } from './cypressInternal'; | ||
|
||
import { testOverrides as testRules } from '../overrides/tests'; | ||
import { namingRules } from '../rules/namingConvention'; | ||
|
||
if (!process.env.NODE_ENV) { | ||
// This check allows us to run linters inside IDE's | ||
process.env.NODE_ENV = 'development'; | ||
} | ||
|
||
const testOverrides = Object.keys(testRules.rules ?? {}).reduce( | ||
(result, ruleKey) => ({ ...result, [ruleKey]: 'off' }), | ||
{}, | ||
); | ||
|
||
module.exports = { | ||
env: { | ||
'cypress/globals': true, | ||
}, | ||
rules: { | ||
...testOverrides, | ||
'promise/catch-or-return': 'off', | ||
'promise/always-return': 'off', | ||
'import/no-import-module-exports': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-namespace': 'off', | ||
'@typescript-eslint/naming-convention': ( | ||
['error'] as Linter.RuleLevelAndOptions | ||
).concat( | ||
( | ||
namingRules[ | ||
'@typescript-eslint/naming-convention' | ||
] as Linter.RuleLevelAndOptions | ||
).slice(1), | ||
[ | ||
{ | ||
selector: 'memberLike', | ||
format: null, | ||
}, | ||
], | ||
) as Linter.RuleLevelAndOptions, | ||
}, | ||
} satisfies Linter.Config; | ||
module.exports = cypressPreset; |
This file contains 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,15 +1,19 @@ | ||
import type { Linter } from 'eslint'; | ||
|
||
import { cypressPreset } from './cypressInternal'; | ||
|
||
if (!process.env.NODE_ENV) { | ||
// This check allows us to run linters inside IDE's | ||
process.env.NODE_ENV = 'development'; | ||
} | ||
|
||
const { extends: extendPreset, ...config } = cypressPreset; | ||
|
||
module.exports = { | ||
overrides: [ | ||
{ | ||
files: ['**/cypress/**/*', '**/*.{cy,cypress}.{js,jsx,ts,tsx}'], | ||
extends: ['@tablecheck/eslint-config/cypress'], | ||
...config, | ||
}, | ||
], | ||
} satisfies Linter.Config; |
This file contains 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,45 @@ | ||
import type { Linter } from 'eslint'; | ||
|
||
import { testOverrides as testRules } from '../overrides/tests'; | ||
import { namingRules } from '../rules/namingConvention'; | ||
|
||
if (!process.env.NODE_ENV) { | ||
// This check allows us to run linters inside IDE's | ||
process.env.NODE_ENV = 'development'; | ||
} | ||
|
||
const testOverrides = Object.keys(testRules.rules ?? {}).reduce( | ||
(result, ruleKey) => ({ ...result, [ruleKey]: 'off' }), | ||
{}, | ||
); | ||
|
||
export const cypressPreset = { | ||
plugins: ['cypress'], | ||
extends: ['@tablecheck/eslint-config/typescript'], | ||
env: { | ||
'cypress/globals': true, | ||
}, | ||
rules: { | ||
...testOverrides, | ||
'promise/catch-or-return': 'off', | ||
'promise/always-return': 'off', | ||
'import/no-import-module-exports': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-namespace': 'off', | ||
'@typescript-eslint/naming-convention': ( | ||
['error'] as Linter.RuleLevelAndOptions | ||
).concat( | ||
( | ||
namingRules[ | ||
'@typescript-eslint/naming-convention' | ||
] as Linter.RuleLevelAndOptions | ||
).slice(1), | ||
[ | ||
{ | ||
selector: 'memberLike', | ||
format: null, | ||
}, | ||
], | ||
) as Linter.RuleLevelAndOptions, | ||
}, | ||
} satisfies Linter.Config; |
This file contains 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,17 @@ | ||
import type { Linter } from 'eslint'; | ||
|
||
import { storybookOverrides } from '../overrides/storybook'; | ||
|
||
if (!process.env.NODE_ENV) { | ||
// This check allows us to run linters inside IDE's | ||
process.env.NODE_ENV = 'development'; | ||
} | ||
|
||
module.exports = { | ||
overrides: [ | ||
{ | ||
extends: ['@tablecheck/eslint-config/typescript'], | ||
...storybookOverrides, | ||
}, | ||
], | ||
} satisfies Linter.Config; |
This file contains 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