lisilinhart / eslint-plugin-pinia

Eslint Plugin for Pinia
https://www.npmjs.com/package/eslint-plugin-pinia
MIT License
26 stars 2 forks source link

support flat style configration #35

Closed kazupon closed 1 month ago

kazupon commented 4 months ago

ESLint has provided flat config since v9. https://eslint.org/docs/latest/use/configure/configuration-files

And in v10 the classical config style will be removed.

It would be nice if it could be easily set up as follows:

import vue from 'eslint-plugin-vue'
import pinia from 'eslint-plugin-pinia'

export default [
  ...vue.configs['flat/recommended'],
  ...pinia.configs.recommended,

  // Currently it can be configured as follows
  // {
  //   files: ['**/*.ts'],
  //   plugins: { pinia },
  //   rules: {
  //     ...pinia.configs.recommended.rules,
  //   },
  // },
]

Since eslint provides an API compatibility list, I think it would be possible to provide rules that work before v9. https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/

if it were supported it would be great, because this plugin could be used for projects that have not yet been migrated that also support it.

lisilinhart commented 3 months ago

Hi @kazupon thanks for the input it makes a lot of sense to do the upgrade. I will take a look into how difficult it is to upgrade the plugin to eslint 9. Looking at the breaking changes it seems dooable: https://eslint.org/docs/latest/use/migrate-to-9.0.0#breaking-changes-for-plugin-developers but there might be some peer dependencies which need to be removed first

n0099 commented 2 months ago
import { FlatCompat } from '@eslint/eslintrc';
const compat = new FlatCompat();
export default [
    ...compat.config(pluginPinia.configs.all)
];
codiini commented 2 months ago

Hi @lisilinhart, if this isn't something you're actively working on right now, I'd love to take it up. I recently did a similar migration for the Intlify Svelte eslint plugin here and here

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 0.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: