All snippets

ESLint flat configuration for AdonisJS and InertiaJS (React)

Jun 18, 2020·1 min read

eslint.config.js

import react from 'eslint-plugin-react'
import jsdoc from 'eslint-plugin-jsdoc'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import reactHooks from 'eslint-plugin-react-hooks'
import { julr } from '@julr/tooling-configs/eslint'

const config = await julr(
  {},
  {
    files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
    plugins: {
      react,
      jsdoc,
      'react-hooks': reactHooks,
      'jsx-a11y': jsxA11y,
    },

    languageOptions: {
      ...react.configs.flat.recommended.languageOptions,
    },

    settings: {
      react: {
        version: 'detect',
      },
    },
    rules: {
      ...react.configs.recommended.rules,
      ...reactHooks.configs.recommended.rules,
      ...jsxA11y.configs.recommended.rules,
      'react/react-in-jsx-scope': 'off',
      // Not recommended to be turned on
      '@typescript-eslint/no-redeclare': 'off',
      // Common pattern in AdonisJS
      '@typescript-eslint/no-empty-object-type': 'off',
    },
  }
)

export default config