Giter VIP home page Giter VIP logo

Comments (5)

thenbe avatar thenbe commented on June 7, 2024 2

This repo includes perfectionist, but you have to enable the rules manually. For example:

  {
    name: 'my-global-rules',
    rules: {
      'import/order': 'off', // handled by perfectionist
      'sort-imports': 'off', // handled by perfectionist
      'perfectionist/sort-imports': 'error',
      'perfectionist/sort-named-imports': 'error',
      'perfectionist/sort-exports': 'error',
    },
  }

I don't know how it compares to eslint-plugin-simple-import-sort, but it's much better than the vanilla rules (import/order and sort-imports) when it comes to consistency (for git diffs).

from eslint-config.

hyoban avatar hyoban commented on June 7, 2024

Thanks for the reminder. This should also be an option. There is no need to introduce additional plug-ins now.

from eslint-config.

antfu avatar antfu commented on June 7, 2024

Would you share some examples of the result of reach rule? To me, the current state seems to work fine.

from eslint-config.

thenbe avatar thenbe commented on June 7, 2024

the current state seems to work fine.

I don't quite remember the details, but there were scenarios where the vanilla sort rules would not handle, whereas the alternative rules from perfectionist was able to handle.

It's been a while, but I think this was my main issue with it: import-js/eslint-plugin-import#1787

from eslint-config.

hyoban avatar hyoban commented on June 7, 2024

Close as it may not be a good idea. If you want it, you can try to use eslint-plugin-perfectionist or eslint-plugin-simple-import-sort.

Example of how to use eslint-plugin-simple-import-sort:

import antfu from '@antfu/eslint-config'
import simpleImportSort from 'eslint-plugin-simple-import-sort'

export default antfu(
  {},
  {
    plugins: {
      'simple-import-sort': simpleImportSort,
    },
    rules: {
      'import/order': 'off',
      'sort-imports': 'off',
      'simple-import-sort/imports': 'error',
      'simple-import-sort/exports': 'error',
    },
  },
)

from eslint-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.