eslint-config-recastui
Version:
Recastui eslint config
176 lines (175 loc) • 5.13 kB
JavaScript
module.exports = {
// Configuration for JavaScript files
extends: ['airbnb-base', 'next', 'turbo', 'plugin:prettier/recommended'],
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
},
overrides: [
// Configuration for mjs files
{
files: ['**/*.mjs'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2015,
},
extends: ['plugin:prettier/recommended'],
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
'import/no-extraneous-dependencies': 'off', // mjs is only used by Astro for configuration, false positive
'import/no-unresolved': 'off', // Also false positive with mjs file
},
},
// Configuration for TypeScript files
{
files: ['**/*.ts', '**/*.tsx'],
plugins: [
'@typescript-eslint',
'react',
'unused-imports',
'tailwindcss',
'simple-import-sort',
],
extends: [
'plugin:tailwindcss/recommended',
'airbnb-typescript',
'plugin:prettier/recommended',
],
parserOptions: {
project: './tsconfig.json',
},
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
'': 'never',
},
], // Avoid missing file extension errors when using '@/' alias
'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
'react/require-default-props': 'off', // Allow non-defined react props as undefined
'react/jsx-props-no-spreading': 'off', // _app.tsx uses spread operator and also, react-hook-form
'@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier
'@typescript-eslint/consistent-type-imports': 'error', // Ensure `import type` is used when it's necessary
'import/prefer-default-export': 'off', // Named export is easier to refactor automatically
'tailwindcss/classnames-order': [
'warn',
{
officialSorting: true,
},
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort`
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
},
},
// Configuration for Astro
{
files: ['**/*.astro'],
plugins: [
'@typescript-eslint',
'react',
'unused-imports',
'tailwindcss',
'simple-import-sort',
],
extends: [
'plugin:tailwindcss/recommended',
'airbnb-typescript',
'plugin:prettier/recommended',
],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
project: './tsconfig.json',
extraFileExtensions: ['.astro'],
},
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
endOfLine: 'auto',
},
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
'': 'never',
},
], // Avoid missing file extension errors in .astro files
'import/no-unresolved': [
'error',
{
ignore: ['@/*'],
},
], // Disable no-unresolved rule for .astro files
'react/jsx-filename-extension': [
1,
{
extensions: ['.astro'],
},
], // Accept jsx in astro files
'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
'react/require-default-props': 'off', // Allow non-defined react props as undefined
'react/jsx-props-no-spreading': 'off', // _app.tsx uses spread operator and also, react-hook-form
'@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier
'@typescript-eslint/consistent-type-imports': 'error', // Ensure `import type` is used when it's necessary
'import/prefer-default-export': 'off', // Named export is easier to refactor automatically
'tailwindcss/classnames-order': [
'warn',
{
officialSorting: true,
},
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort`
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
},
globals: {
Astro: 'readonly',
},
},
],
};