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

eslint-plugin-autofix bug unused vars and args not removed #94

Open
khanakia opened this issue Jun 29, 2024 · 0 comments
Open

eslint-plugin-autofix bug unused vars and args not removed #94

khanakia opened this issue Jun 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@khanakia
Copy link

Tell us about your environment

  • eslint version: 8.57.0
  • eslint-plugin-autofix version: ^2.0.0
  • eslint config:
/**
 * This is intended to be a basic starting point for linting in your app.
 * It relies on recommended configs out of the box for simplicity, but you can
 * and should modify this configuration to best suit your team's needs.
 */

/** @type {import('eslint').Linter.Config} */
module.exports = {
  ignorePatterns: ['public/', '**/generated/*.ts'],
  extends: ['next/core-web-vitals'],
  plugins: [
    'unused-imports',
    'simple-import-sort',
    '@typescript-eslint',
    'prettier',
    'autofix',
  ],
  rules: {
    'prettier/prettier': ['error', { singleQuote: true, endOfLine: 'auto' }],
    // disable <img> warning
    '@next/next/no-img-element': 'off',

    // disable warning  React Hook useMemo has missing dependencies: 'getPageInfo', 'handleTableChange', 'onLoadMore', 'query', and 'setQuery'. Either include them or remove the dependency array  react-hooks/exhaustive-deps
    'react-hooks/exhaustive-deps': 'off',

    // unused imports - https://typescript-eslint.io/rules/no-unused-vars/
    // Note: you must disable the base rule as it can report incorrect errors
    'no-unused-vars': 'off',
    'unused-imports/no-unused-imports': 'error', // remove unused imports automatically using --fix
    '@typescript-eslint/no-unused-vars': [
      // 'unused-imports/no-unused-vars': [
      'warn',
      {
        vars: 'all',
        varsIgnorePattern: '^_',
        args: 'after-used',
        argsIgnorePattern: '^_',
      },
    ],

    // --fix auto sort all the imports
    'simple-import-sort/imports': 'error',

    '@typescript-eslint/quotes': [
      'error',
      'single',
      {
        allowTemplateLiterals: true,
      },
    ],

    'no-restricted-imports': [
      'error',
      {
        patterns: [
          {
            group: ['@/features/ui/components/*', '!@/features/ui/components'],
          },
        ],
      },
    ],
    'autofix/no-debugger': 'error',
  },
}
  • source code:
import { getCurrentTeam } from '@/features/bite/serverfn'
import DynamicSection from '@/features/jeoga/components/other/DynamicSection'
import Footer from '@/features/jeoga/components/other/Footer'

export default async function FooterServer(props: any) {
  const team = await getCurrentTeam()
  return (
    <>
      <DynamicSection id={team?.section_footer_id} />
      <Footer />
    </>
  )
}

Expected behavior
It should remove the (props:any) as it's unused

Actual behavior

./src/features/jeoga/components/other/FooterServer.tsx
5:44  Warning: 'props' is defined but never used. Allowed unused args must match /^_/u.  @typescript-eslint/no-unused-vars
@khanakia khanakia added the bug Something isn't working label Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants