QwikDev / qwik

Instant-loading web apps, without effort
https://qwik.dev
MIT License
20.71k stars 1.29k forks source link

[✨] feat: add support for eslint flat config - eslint-plugin-qwik #6048

Open TheElegantCoding opened 6 months ago

TheElegantCoding commented 6 months ago

Please add support for ESLint 9, including Flat config support.

See:

Thanks!

devcaeg commented 6 months ago

I am using flat config from ESLint several months ago, and this is my configuration with Qwik, so far it works correctly.

eslint.config.js

import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import prettierPlugin from 'eslint-plugin-prettier';
import qwikPlugin from 'eslint-plugin-qwik';
import globals from 'globals';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
  {
    files: ['src/**/*.ts*'],
    languageOptions: {
      globals: {
        ...globals.node,
      },
      parser: typescriptParser,
      parserOptions: {
        ecmaFeatures: {
          jsx: true,
        },
        ecmaVersion: 'latest',
        project: ['./tsconfig.json'],
        sourceType: 'module',
        tsconfigRootDir: import.meta.dir,
      },
    },
    plugins: {
      '@typescript-eslint': typescriptPlugin,
      prettier: prettierPlugin,
      qwik: qwikPlugin,
    },
    rules: {
      ...prettierPlugin.configs.recommended.rules,
      ...qwikPlugin.configs.recommended.rules,
      ...typescriptPlugin.configs['strict-type-checked'].rules,
      ...typescriptPlugin.configs['stylistic-type-checked'].rules,
    },
  },
];
TheElegantCoding commented 6 months ago

yes this kind of work but the types are not well defined

TheElegantCoding commented 5 months ago

update this is the error the package has no support for typescript, te export is any image

mrcaidev commented 4 months ago

Temporary workaround: use ESLint official FlatCompat.

pnpm add -D @eslint/eslintrc
// eslint.config.js
import { FlatCompat } from "@eslint/eslintrc";

const compat = new FlatCompat({
  baseDirectory: import.meta.dirname,
});

export default [
  // other configs
  ...compat.extends("plugin:qwik/recommended")
];