Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TheElegantCoding opened this issue Mar 23, 2024 · 11 comments
Open
Labels
COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it COMP: DX Developer Experience related issue COMP: eslint STATUS-2: waiting for community PR

Comments

@TheElegantCoding
Copy link

TheElegantCoding commented Mar 23, 2024

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

See:

Thanks!


Maintainer update:

The idea is that the plugin keeps supporting v8, but also supports v9 better so that the types work correctly.

Furthermore, the qwik codebase and starters should use v9, so all eslint configs need updating.

@devcaeg
Copy link

devcaeg commented Mar 24, 2024

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
Copy link
Author

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

@TheElegantCoding
Copy link
Author

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

@mrcaidev
Copy link
Contributor

mrcaidev commented May 31, 2024

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")
];

@shairez shairez added TYPE: enhancement New feature or request COMP: eslint COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it STATUS-2: waiting for community PR labels Jun 3, 2024
@PatrickJS PatrickJS added STATUS-1: needs triage New issue which needs to be triaged COMP: DX Developer Experience related issue STATUS-2: waiting for community PR COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it and removed TYPE: enhancement New feature or request COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it STATUS-2: waiting for community PR STATUS-1: needs triage New issue which needs to be triaged labels Jun 3, 2024
@naorpeled naorpeled self-assigned this Jun 15, 2024
@wmertens
Copy link
Member

wmertens commented Nov 4, 2024

@JerryWu1234 how about this one?

@JerryWu1234
Copy link
Contributor

@JerryWu1234 how about this one?

I can do it

@JerryWu1234
Copy link
Contributor

JerryWu1234 commented Nov 4, 2024

@wmertens
I remembered there was PR about our migration from eslint to Biome.

and someone is focusing on.

@naorpeled naorpeled removed their assignment Nov 4, 2024
@JerryWu1234
Copy link
Contributor

#6115

@JerryWu1234
Copy link
Contributor

#6837

@JerryWu1234
Copy link
Contributor

JerryWu1234 commented Nov 22, 2024

@mrcaidev @devcaeg
Could you help to try it when you are available?

@JerryWu1234 JerryWu1234 moved this from Backlog to In progress in Qwik Development Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it COMP: DX Developer Experience related issue COMP: eslint STATUS-2: waiting for community PR
Projects
Status: In progress
Development

No branches or pull requests

8 participants