diff --git a/eslint-config/blui-rules.js b/eslint-config/blui-rules.js index 40a0b49..510aa1d 100644 --- a/eslint-config/blui-rules.js +++ b/eslint-config/blui-rules.js @@ -1,4 +1,4 @@ -const bluiRules = { +export default { '@typescript-eslint/array-type': ['error', { default: 'array-simple' }], '@typescript-eslint/consistent-type-definitions': ['error', 'type'], '@typescript-eslint/explicit-function-return-type': 'error', @@ -6,7 +6,7 @@ const bluiRules = { 'error', { selector: 'default', - format: ['camelCase'], + format: ['camelCase', 'PascalCase'], }, { selector: 'variable', @@ -36,11 +36,14 @@ const bluiRules = { format: ['camelCase'], leadingUnderscore: 'require', }, - { selector: 'typeLike', format: ['PascalCase'], }, + { + selector: 'import', + format: ['camelCase', 'PascalCase'], + }, ], '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/explicit-module-boundary-types': ['error', { allowArgumentsExplicitlyTypedAsAny: true }], @@ -108,8 +111,6 @@ const bluiRules = { 'prefer-spread': 'error', 'prefer-template': 'error', 'sort-imports': 'off', - 'no-shadow': 'off', - '@typescript-eslint/no-shadow': ['error'], + "no-shadow": "off", + "@typescript-eslint/no-shadow": ["error"] }; - -module.exports = bluiRules; diff --git a/eslint-config/ts.js b/eslint-config/ts.js deleted file mode 100644 index e83e136..0000000 --- a/eslint-config/ts.js +++ /dev/null @@ -1,12 +0,0 @@ -const tsProfile = { - parser: '@typescript-eslint/parser', // Specifies the ESLint parser - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'eslint-config-prettier', - ], - rules: require('./blui-rules'), -}; - -module.exports = tsProfile; diff --git a/eslint-config/ts.mjs b/eslint-config/ts.mjs new file mode 100644 index 0000000..397129b --- /dev/null +++ b/eslint-config/ts.mjs @@ -0,0 +1,19 @@ +import js from "@eslint/js"; +import tseslint from "typescript-eslint"; +import prettierRecommended from "eslint-plugin-prettier/recommended"; +import bluiRules from './blui-rules.js' + +export default [ + js.configs.recommended, + tseslint.configs.eslintRecommended, + ...tseslint.configs.recommendedTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + prettierRecommended, + { + rules: { + 'react/prop-types': 'off', + 'react/display-name': 'off', + ...bluiRules + }, + } +]; diff --git a/eslint-config/tsx.js b/eslint-config/tsx.js deleted file mode 100644 index e092b15..0000000 --- a/eslint-config/tsx.js +++ /dev/null @@ -1,25 +0,0 @@ -const tsxProfile = { - parser: '@typescript-eslint/parser', // Specifies the ESLint parser - extends: [ - 'eslint:recommended', - 'plugin:react/recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'eslint-config-prettier', - ], - settings: { - react: { - version: 'detect', - }, - }, - rules: Object.assign( - { - 'react/prop-types': 'off', - 'react/display-name': 'off', - }, - require('./blui-rules') - ), -}; - -module.exports = tsxProfile; diff --git a/eslint-config/tsx.mjs b/eslint-config/tsx.mjs new file mode 100644 index 0000000..2eddd30 --- /dev/null +++ b/eslint-config/tsx.mjs @@ -0,0 +1,30 @@ +import js from "@eslint/js"; +import reactRecommened from "eslint-plugin-react/configs/recommended.js" +import tseslint from "typescript-eslint"; +import prettierRecommended from "eslint-plugin-prettier/recommended"; +import typescriptEslintParser from "@typescript-eslint/parser"; +import bluiRules from './blui-rules.js' + +export default [ + js.configs.recommended, + tseslint.configs.eslintRecommended, + ...tseslint.configs.recommendedTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + reactRecommened, + prettierRecommended, + { + languageOptions: { + parser: typescriptEslintParser + }, + settings: { + react: { + version: 'detect', + }, + }, + rules: { + 'react/prop-types': 'off', + 'react/display-name': 'off', + ...bluiRules + }, + } +];