Skip to content

Commit

Permalink
ESLint: upgrade eslint-plugin-import
Browse files Browse the repository at this point in the history
  • Loading branch information
shvlv committed Oct 9, 2024
1 parent 02cdcc5 commit 80c5526
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 274 deletions.
54 changes: 26 additions & 28 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,32 @@ module.exports = [
...wordPress.configs.recommended,
comments.recommended,
...storybook.configs[ 'flat/recommended' ], // @TODO check if subdirectory stories do work https://github.com/storybookjs/eslint-plugin-storybook/issues/135#issuecomment-2198331953
...tseslint.config( {
extends: [ tseslint.configs.base ],
files: [ '**/*.ts', '**/*.tsx' ],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: 'react',
message:
'Please use React API through `@wordpress/element` instead.',
allowTypeImports: true,
},
],
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: false,
},
],
},
} ),
{
languageOptions: {
globals: {
Expand Down Expand Up @@ -261,34 +287,6 @@ module.exports = [
'@wordpress/wp-global-usage': 'off',
},
},
...tseslint.config( {
extends: [ tseslint.configs.base ],
files: [ '**/*.ts', '**/*.tsx' ],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: 'react',
message:
'Please use React API through `@wordpress/element` instead.',
allowTypeImports: true,
},
],
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: false,
},
],
// TypeScript's compilation already ensures that named imports exist in the referenced module
'import/named': 'off',
},
} ),
{
files: [
'**/*.@(android|ios|native).js',
Expand Down
Loading

0 comments on commit 80c5526

Please sign in to comment.