Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ESLint config #1

Open
6 tasks
arthur-fontaine opened this issue Mar 16, 2024 · 0 comments · May be fixed by #3
Open
6 tasks

Change ESLint config #1

arthur-fontaine opened this issue Mar 16, 2024 · 0 comments · May be fixed by #3
Assignees

Comments

@arthur-fontaine
Copy link
Owner

arthur-fontaine commented Mar 16, 2024

  • Remove the current .eslintrc.js.
  • Add a new eslint.config.mjs
  • Copy ESLint config (see below) (you will need to install missing dependencies)
  • Add eslint-plugin-use-encapsulation
  • In .vscode/settings.json, add "eslint.experimental.useFlatConfig": true
  • Fix errors (you may fix a lot off errors by running pnpm lint:fix)
ESLint config to copy
import antfu, { pluginPerfectionist, pluginTs } from '@antfu/eslint-config'
import filenamePlugin from 'eslint-plugin-filename-rules'
import fpPlugin from 'eslint-plugin-fp'

export default antfu(
  {
    rules: {
      ...pluginPerfectionist.configs['recommended-natural'].rules,
      'perfectionist/sort-imports': 'off',
      'style/indent': ['error', 2, {
        flatTernaryExpressions: true,
      }],
      'style/max-len': ['error', {
        code: 80,
        comments: 120,
        ignoreStrings: true,
        ignoreTemplateLiterals: true,
        ignoreTrailingComments: true,
        ignoreUrls: true,
        tabWidth: 2,
      }],
      'style/multiline-ternary': 'off',
    },
    stylistic: true,
  },
  {
    plugins: {
      ts: pluginTs,
    },
    rules: {
      'ts/naming-convention': 'error',
      'ts/no-import-type-side-effects': 'error',
      'ts/no-use-before-define': 'off',
    },
  },
  {
    plugins: {
      'filename-rules': filenamePlugin,
      'fp': fpPlugin,
    },
    rules: {
      'curly': ['error', 'all'],

      'filename-rules/not-match': [2, /(^index\..*)/],

      'fp/no-throw': 'error',

      'import/no-default-export': ['error'],

      'ts/no-explicit-any': ['error'],
      'unicorn/filename-case': [
        'error',
        {
          case: 'kebabCase',
        },
      ],
      'unicorn/switch-case-braces': ['error'],
    },
  },
  {
    files: ['**/*.config.*'],
    rules: {
      'import/no-default-export': 'off',
    },
  },
  {
    ignores: ['**/__generated__/**', '**/*.config.*'],
  },
)
@Cammyxalot Cammyxalot self-assigned this Mar 17, 2024
@Cammyxalot Cammyxalot linked a pull request Mar 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants