ionic-team / starters

Starter templates for Ionic apps, used by the Ionic CLI
MIT License
462 stars 316 forks source link

refactor(react): update .eslintrc.js and rename to .eslintrc.cjs #1854

Open aretrace opened 3 months ago

aretrace commented 3 months ago

Add additional configuration for proper linting such as including @typescript-eslint/recommended plugin.

aretrace commented 3 months ago

this should also address ionic-team/ionic-cli#5015

sean-perkins commented 3 months ago

@aretrace the starter templates are based around the Vite default templates created from the Vite CLI.

Would you be interested in updating your PR to using valid ESM instead of renaming the file to cjs?

e.g.:

import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config({
  extends: [js.configs.recommended, ...tseslint.configs.recommended],
  files: ['**/*.{ts,tsx}'],
  ignores: ['dist'],
  languageOptions: {
    ecmaVersion: 2020,
    globals: globals.browser,
  },
  plugins: {
    'react-hooks': reactHooks,
    'react-refresh': reactRefresh,
  },
  rules: {
    ...reactHooks.configs.recommended.rules,
    'react-refresh/only-export-components': [
      'warn',
      { allowConstantExport: true },
    ],
  },
})
aretrace commented 3 months ago

Is this template used by the @ionic/cli? I am looking to refactor the eslint config for the React -> ${name} -> blank starter project.