Merged in fix/linting (pull request #2708)
Fix/linting * fix import issues and add lint check no-extraneous-dependencies * fix use type HotelType instead of string Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -7,11 +7,16 @@ import js from '@eslint/js'
|
||||
import importPlugin from 'eslint-plugin-import'
|
||||
import formatjs from 'eslint-plugin-formatjs'
|
||||
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'node:path'
|
||||
|
||||
const compat = new FlatCompat({
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
})
|
||||
|
||||
const packageDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
languageOptions: {
|
||||
@@ -31,8 +36,28 @@ export default defineConfig([
|
||||
import: importPlugin,
|
||||
formatjs,
|
||||
},
|
||||
settings: {
|
||||
// Ensure the plugin can resolve workspace packages and TS path aliases
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
project: [path.join(packageDir, 'tsconfig.json')],
|
||||
alwaysTryTypes: true,
|
||||
},
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'import/no-relative-packages': 'error',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
{
|
||||
includeInternal: true,
|
||||
includeTypes: true,
|
||||
packageDir: [packageDir],
|
||||
},
|
||||
],
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{
|
||||
@@ -53,5 +78,11 @@ export default defineConfig([
|
||||
'formatjs/prefer-pound-in-plural': ['error'],
|
||||
},
|
||||
},
|
||||
globalIgnores(['**/dist', '**/.eslintrc.cjs']),
|
||||
{
|
||||
files: ['**/*.stories.tsx'],
|
||||
rules: {
|
||||
'formatjs/no-literal-string-in-jsx': 'off',
|
||||
},
|
||||
},
|
||||
globalIgnores(['**/dist', '**/.eslintrc.cjs', '**/storybook-static']),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user