mightyiam / eslint-config-love

A TypeScript ESLint config that loves you
MIT License
740 stars 64 forks source link

Migration guide v47.0 to v48.0 #1561

Closed joshlopes closed 1 month ago

joshlopes commented 1 month ago

I was using v47.0.0, I migrated to v48.0.0 using the example you give in README but without success -- It doesn't show any errors and it "executes" but the fact is that it is also not applying any rules for Typescript and I start to wonder if that's because of the project / parser changes.

I think this needs a little bit more of a direction and guide -- I feel like people don't know what they have to do to migrate from v47 to v48 so their implementations works exactly the same way e.g.:

With V47:

#.eslintrc.js
module.exports = {
    overrides: [
        {
            files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
            extends: 'love',
            rules: {
                '@typescript-eslint/no-empty-interface': 'off',
            }
        }
    ],
    ignorePatterns: [
        'jest.config.ts',
        '.eslintrc.js',
        'babel.config.js',
        'node_modules/',
        'tests/',
    ],
}
npm run lint

> npx eslint .

.../Foo.ts
  17:1  error  Expected indentation of 6 spaces but found 0  @typescript-eslint/indent

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

After upgrading to V48

# eslint.config.cjs
module.exports = [{
    ...require('eslint-config-love'),
    files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
    rules: {
        '@typescript-eslint/no-empty-interface': 'off',
    },
    ignores: [
        'jest.config.ts',
        'eslint.config.cjs',
        'babel.config.js',
        'node_modules/',
        'tests/',
    ],
}]
> npx eslint .

(Nothing outputs which makes me think all runs and is fine.

joshlopes commented 1 month ago

I figured it out, it seems that the flat version my rules is overriding all love config rules -- so I needed to re-do the rules from require and then set the one I wanted off.

Also I noticed that files also need to change to **/*.{file_extension} so **/*.ts

https://eslint.org/docs/latest/use/configure/migration-guide#glob-based-configs

this also helps

mightyiam commented 1 month ago

Thank you, but ESLint has a migration guide. That should suffice.

joshlopes commented 1 month ago

Appreciate the comment. But libraries like this one are meant to facilitate and not to have to bother with ESlint stuff is what I love the most using this lib -- In your readme you don't even point to the migration of eslint documentation , I would never look for it because I find ESLint an ocean of madness of configuration and libraries which yours attempts to abstract

Again that said, I think you should point people to clearly migrate their configuration and if they had more elaborate configurations point them to that ESLint page. That's my 50 cents.

joshlopes commented 1 month ago

On a second look @mightyiam I think your README example might not work as the files should be **/*.ts if the files are inside folders -- might that would actually help massively for me, I think the current file differs from the previous as the previous would work with /src and the current does not.

mightyiam commented 1 month ago

@joshlopes sorry about that. Corrected in #1563 .

mightyiam commented 1 month ago

1564 and edited https://github.com/mightyiam/eslint-config-love/releases/tag/v48.0.0