Update ESLint rule tests for flat config format
- Update RuleTester to use flat config languageOptions instead of eslintrc parser format - Remove duplicate test case that ESLint v9 now detects - Add Jest globals for test files
This commit is contained in:
@@ -210,4 +210,14 @@ export default tseslint.config(
|
|||||||
'no-control-regex': 'off',
|
'no-control-regex': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Test files configuration
|
||||||
|
{
|
||||||
|
files: ['**/__tests__/**/*.{js,jsx,ts,tsx}', '**/*.test.{js,jsx,ts,tsx}'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.jest,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
const {RuleTester} = require('eslint')
|
const {RuleTester} = require('eslint')
|
||||||
|
const tseslint = require('typescript-eslint')
|
||||||
const avoidUnwrappedText = require('../avoid-unwrapped-text')
|
const avoidUnwrappedText = require('../avoid-unwrapped-text')
|
||||||
|
|
||||||
const ruleTester = new RuleTester({
|
const ruleTester = new RuleTester({
|
||||||
parser: require.resolve('@typescript-eslint/parser'),
|
languageOptions: {
|
||||||
parserOptions: {
|
parser: tseslint.parser,
|
||||||
ecmaFeatures: {
|
parserOptions: {
|
||||||
jsx: true,
|
ecmaFeatures: {
|
||||||
|
jsx: true,
|
||||||
|
},
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
ecmaVersion: 6,
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -773,15 +776,6 @@ function MyText({ foo }) {
|
|||||||
errors: 1,
|
errors: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
code: `
|
|
||||||
<View>
|
|
||||||
<Trans>{'foo'}</Trans>
|
|
||||||
</View>
|
|
||||||
`,
|
|
||||||
errors: 1,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
code: `
|
code: `
|
||||||
<View prop={
|
<View prop={
|
||||||
|
|||||||
Reference in New Issue
Block a user