[Bug] No Fix for `sort-imports` ?
See original GitHub issueTell us about your environment
- ESLint Version: v5.16.10
- Node Version: v11.13.0
- npm Version: v6.9.0
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
Configuration
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:react/recommended',
// 'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2019,
ecmaFeatures: {
jsx: true,
},
},
rules: {
'@typescript-eslint/arrow-parens': [true],
'@typescript-eslint/await-promise': [true],
'@typescript-eslint/max-classes-per-file': false,
'@typescript-eslint/no-console': [false],
'@typescript-eslint/no-floating-promises': [true],
'@typescript-eslint/object-literal-key-quotes': [false],
'@typescript-eslint/object-literal-sort-keys': [false],
'@typescript-eslint/ordered-imports': [false],
'@typescript-eslint/quotemark': [true, 'single', 'avoid-escape'],
'@typescript-eslint/semicolon': [true, 'never'],
'@typescript-eslint/trailing-comma': [true],
'jsx-quotes': ['error', 'prefer-single'],
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: false,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
},
],
},
settings: {
react: {
version: 'detect',
},
},
}
What did you expect to happen? imports to be sorted with --fix
What actually happened? Please include the actual, raw output from ESLint. Not that.
Are you willing to submit a pull request to fix this bug? No.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
sort-import does not auto fix · Issue #11542 · eslint/eslint · GitHub
Hi, thanks for the proposal. However, I don't think it would be safe for sort-imports to autofix code because it could change the...
Read more >Add ESLint Rules to Sort Imports And Audit Accessibility
Adding ESLint rules to sort imports statements and audit accessibility will ensure code consistency across the team and catch some errors early.
Read more >sort-imports - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Bug #1894078 “PyLint 2.3.0 isort attribute error” : Bugs : Cinder
AttributeError: module 'isort' has no attribute 'SortImports'. Cinder PyLint result with 2.3.0: michael@unit-test:~/OpenStack/unit_tests$ ...
Read more >ESLint sort imports - remarkablemark
How to automatically sort imports with ESLint. ... As a result, there's no automatic fix for this rule. You'll either need to manually...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Industrial it’s not always. Polyfills and shims are supposed to cause side effects and be written in that way.
However, typically the only imports with side effects are ones without a binding - just like it’s safe to reorganize properties as long as nothing crosses a spread, it’s safe to sort imports as long as nothing crosses a bindingless import.
@lydell
That should be a code smell. An indicator for people to not write their code in this way. I don’t think it should be a problem to be prevented by not implementing the sorting :S