starters icon indicating copy to clipboard operation
starters copied to clipboard

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

Open aretrace opened this issue 1 year ago • 3 comments

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

aretrace avatar Aug 08 '24 04:08 aretrace

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

aretrace avatar Aug 08 '24 04:08 aretrace

@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 },
    ],
  },
})

sean-perkins avatar Aug 09 '24 19:08 sean-perkins

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

aretrace avatar Aug 10 '24 09:08 aretrace