-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* migrate react config Signed-off-by: Kangrui Johann Ye <[email protected]> * migrate react hooks config Signed-off-by: Kangrui Johann Ye <[email protected]> * migrate jsx a11y config Signed-off-by: Kangrui Johann Ye <[email protected]> * fix typescript version for internal types Signed-off-by: Kangrui Johann Ye <[email protected]> * bump version Signed-off-by: Kangrui Johann Ye <[email protected]> --------- Signed-off-by: Kangrui Johann Ye <[email protected]>
- Loading branch information
1 parent
7ece559
commit 350f78d
Showing
24 changed files
with
706 additions
and
266 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
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
import {TSESLint} from '@typescript-eslint/utils'; | ||
|
||
export const reactRules: TSESLint.Linter.RulesRecord = { | ||
'react/static-property-placement': ['error', 'static public field'], | ||
'react/jsx-fragments': ['error', 'element'], | ||
'react/sort-comp': [ | ||
1, | ||
{ | ||
order: [ | ||
'type-annotations', | ||
'static-variables', | ||
'instance-variables', | ||
'lifecycle', | ||
'static-methods', | ||
'instance-methods', | ||
'everything-else', | ||
'render', | ||
], | ||
}, | ||
], | ||
'react/no-array-index-key': ['error'], | ||
}; |
30 changes: 0 additions & 30 deletions
30
packages/eslint-plugin-react/src/configs/recommended/recommended.config.ts
This file was deleted.
Oops, something went wrong.
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,2 +1,63 @@ | ||
export {configs} from './configs'; | ||
export {rules} from './rules'; | ||
import tseslint from 'typescript-eslint'; | ||
import { | ||
cloudflightTypescriptBaseConfig, | ||
cloudflightTypescriptConfig, cloudflightTypescriptDisableTypeCheckedConfig, | ||
cloudflightTypescriptImportConfig | ||
} from '@cloudflight/eslint-plugin-typescript'; | ||
import type {TSESLint} from '@typescript-eslint/utils'; | ||
import * as tsParser from '@typescript-eslint/parser'; | ||
// see https://github.com/jsx-eslint/eslint-plugin-react/issues/3838 | ||
// eslint-disable-next-line import-x/default | ||
import react from 'eslint-plugin-react'; | ||
import pluginReactHooks from 'eslint-plugin-react-hooks'; | ||
import jsxA11y from 'eslint-plugin-jsx-a11y'; | ||
import {reactRules} from './configs/react'; | ||
|
||
export const cloudflightReactConfig = tseslint.config( | ||
...cloudflightTypescriptConfig, | ||
{ | ||
files: ['**/*.{js,jsx,mjs,cjs,ts,mts,cts,tsx}'], | ||
plugins: { | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
'react-hooks': pluginReactHooks as TSESLint.FlatConfig.Plugin, | ||
}, | ||
extends: [ | ||
// eslint-disable-next-line @typescript-eslint/no-deprecated | ||
...cloudflightTypescriptBaseConfig, | ||
// eslint-disable-next-line @typescript-eslint/no-deprecated | ||
...cloudflightTypescriptImportConfig, | ||
// type assertion is workaround for incorrect TypeScript types in eslint-plugin-react | ||
// see https://github.com/jsx-eslint/eslint-plugin-react/issues/3838 | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
react.configs.flat.recommended as TSESLint.FlatConfig.Config, | ||
// type assertion is workaround for incorrect TypeScript types in eslint-plugin-react | ||
// see https://github.com/jsx-eslint/eslint-plugin-react/issues/3838 | ||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions | ||
react.configs.flat['jsx-runtime'] as TSESLint.FlatConfig.Config, | ||
jsxA11y.flatConfigs.recommended, | ||
], | ||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
parserOptions: { | ||
jsxPragma: null, | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
name: 'cloudflight/react/rules', | ||
rules: { | ||
...pluginReactHooks.configs.recommended.rules, | ||
...reactRules, | ||
} | ||
}, | ||
{ | ||
files: ['**/*.{js,jsx,mjs,cjs}'], | ||
extends: [ | ||
// eslint-disable-next-line @typescript-eslint/no-deprecated | ||
...cloudflightTypescriptDisableTypeCheckedConfig, | ||
], | ||
}, | ||
); |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.