2.3.0 • Published 2 years ago

@simplo-sro/eslint-config v2.3.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

eslint-config-simplo

Sharable flat ESLint config for Simplo projects

Using the config

Use ESLint >= v8.45.0 for flat config support.

Install the @simplo-sro/eslint-config package.

For Webpack / Vite

For shop admin / themes

Import the config package:

const simploConfig = require('@simplo-sro/eslint-config');

(or with ESM syntax)

import simploConfig from '@simplo-sro/eslint-config';

Then append the generated config from this package, as such:

...simploConfig.createConfig({ projectType: 'webpack-vite' }),

Nuxt

Use the ESLint module.

Generate the config with withNuxt(), passing this package's config as such:

import simploConfig from '@simplo-sro/eslint-config';

export default withNuxt(
    ...simploConfig.createConfig({ projectType: 'nuxt' }),
)

This will first generate the config for your Nuxt project, then overrides it with rules generated in this config package.

Nuxt ESLint plugin will import ESLint plugins by default, and since those plugins are already imported in this config, this will lead to duplicate imports - to which, ESLint will respond with a crash. So, don't forget to add this to the root of your nuxt.config.ts

eslint: {
    config: {
        standalone: false,
    }
},

Configurations

This config is split into multiple sub-configs in /configurations:

  • base
    • simplo/base - overrides for ESLint recommended rules
    • simplo/base/formatting - rules for formatting/style from @stylistic/eslint-plugin
  • vue - Overrides for flat/recommended rules from eslint-plugin-vue
  • typescript - Typescript specific rules (includes rules ported over from @nuxtjs/eslint-config-typescript) and overrides for tseslint.configs.recommended from typescript-eslint
  • tailwind - Overrides for flat/recommended rules from eslint-plugin-tailwindcss

Linting the config

This config is self-linting:

npm run lint
npm run lint:fix