Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
import globals from 'globals'
|
||||
import tsParser from '@typescript-eslint/parser'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import react from 'eslint-plugin-react'
|
||||
import { FlatCompat } from '@eslint/eslintrc'
|
||||
import js from '@eslint/js'
|
||||
import importPlugin from 'eslint-plugin-import'
|
||||
import formatjs from 'eslint-plugin-formatjs'
|
||||
import { defineConfig, globalIgnores } from "eslint/config"
|
||||
import globals from "globals"
|
||||
import tsParser from "@typescript-eslint/parser"
|
||||
import reactRefresh from "eslint-plugin-react-refresh"
|
||||
import react from "eslint-plugin-react"
|
||||
import { FlatCompat } from "@eslint/eslintrc"
|
||||
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'
|
||||
import { fileURLToPath } from "node:url"
|
||||
import path from "node:path"
|
||||
|
||||
const compat = new FlatCompat({
|
||||
recommendedConfig: js.configs.recommended,
|
||||
@@ -27,72 +27,72 @@ export default defineConfig([
|
||||
parser: tsParser,
|
||||
},
|
||||
extends: compat.extends(
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:storybook/recommended'
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react-hooks/recommended",
|
||||
"plugin:storybook/recommended"
|
||||
),
|
||||
plugins: {
|
||||
'react-refresh': reactRefresh,
|
||||
"react-refresh": reactRefresh,
|
||||
import: importPlugin,
|
||||
formatjs,
|
||||
react,
|
||||
},
|
||||
settings: {
|
||||
// Ensure the plugin can resolve workspace packages and TS path aliases
|
||||
'import/resolver': {
|
||||
"import/resolver": {
|
||||
typescript: {
|
||||
project: [path.join(packageDir, 'tsconfig.json')],
|
||||
project: [path.join(packageDir, "tsconfig.json")],
|
||||
alwaysTryTypes: true,
|
||||
},
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'import/no-relative-packages': 'error',
|
||||
'import/no-extraneous-dependencies': [
|
||||
'error',
|
||||
"import/no-relative-packages": "error",
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
includeInternal: true,
|
||||
includeTypes: true,
|
||||
packageDir: [packageDir],
|
||||
},
|
||||
],
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
"react-refresh/only-export-components": [
|
||||
"warn",
|
||||
{
|
||||
allowConstantExport: true,
|
||||
},
|
||||
],
|
||||
'react/jsx-curly-brace-presence': [
|
||||
'error',
|
||||
"react/jsx-curly-brace-presence": [
|
||||
"error",
|
||||
{
|
||||
props: 'never',
|
||||
children: 'never',
|
||||
propElementValues: 'always',
|
||||
props: "never",
|
||||
children: "never",
|
||||
propElementValues: "always",
|
||||
},
|
||||
],
|
||||
|
||||
'formatjs/enforce-default-message': ['error', 'literal'],
|
||||
'formatjs/enforce-placeholders': ['error'],
|
||||
'formatjs/enforce-plural-rules': ['error'],
|
||||
'formatjs/no-literal-string-in-jsx': ['error'],
|
||||
'formatjs/no-multiple-whitespaces': ['error'],
|
||||
'formatjs/no-multiple-plurals': ['error'],
|
||||
'formatjs/no-invalid-icu': ['error'],
|
||||
'formatjs/enforce-id': ['error'],
|
||||
'formatjs/no-complex-selectors': ['error'],
|
||||
'formatjs/no-useless-message': ['error'],
|
||||
'formatjs/prefer-pound-in-plural': ['error'],
|
||||
"formatjs/enforce-default-message": ["error", "literal"],
|
||||
"formatjs/enforce-placeholders": ["error"],
|
||||
"formatjs/enforce-plural-rules": ["error"],
|
||||
"formatjs/no-literal-string-in-jsx": ["error"],
|
||||
"formatjs/no-multiple-whitespaces": ["error"],
|
||||
"formatjs/no-multiple-plurals": ["error"],
|
||||
"formatjs/no-invalid-icu": ["error"],
|
||||
"formatjs/enforce-id": ["error"],
|
||||
"formatjs/no-complex-selectors": ["error"],
|
||||
"formatjs/no-useless-message": ["error"],
|
||||
"formatjs/prefer-pound-in-plural": ["error"],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.stories.tsx'],
|
||||
files: ["**/*.stories.tsx"],
|
||||
rules: {
|
||||
'formatjs/no-literal-string-in-jsx': 'off',
|
||||
"formatjs/no-literal-string-in-jsx": "off",
|
||||
},
|
||||
},
|
||||
globalIgnores(['**/dist', '**/.eslintrc.cjs', '**/storybook-static']),
|
||||
globalIgnores(["**/dist", "**/.eslintrc.cjs", "**/storybook-static"]),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user