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
Bug: eslint --fix breaks code when airbnb no-duplicate-imports happens #15660
Comments
Hi @sergeykimaia, thanks for the issue! The core rule |
@mdjermanovic missing comma after SafeAreaView haven't included unused variable warnings also want to add that running eslint fix for:
produces the expected result |
This comment was marked as outdated.
This comment was marked as outdated.
Thanks for the info! I thought it's a bug in a plugin rule |
ahhhh right, the combination of |
This is exactly what happens. With this configuration: module.exports = {
plugins: ["import"],
rules: {
"comma-dangle": ["error", { imports: "always-multiline" }],
"import/no-duplicates": ["error"]
},
parserOptions: {
sourceType: "module",
ecmaVersion: 2022
}
}; and this code: import {
StyleSheet,
View,
TextInput,
ImageBackground,
Image,
TouchableOpacity,
SafeAreaView
} from 'react-native';
import { I18nManager } from 'react-native'; the two rules produce the following fixes:
Since the ranges are not overlapping, both fixes will be applied in the same pass: import {
StyleSheet,
View,
TextInput,
ImageBackground,
Image,
TouchableOpacity,
SafeAreaView,
, I18nManager } from 'react-native'; That results in two commas, which is a parsing error. I made a PR to fix this in comma-dangle: #15669 |
Environment
Node version: v14.17.1
npm version: 6.14.13
Local ESLint version: "^8.10.0"
Global ESLint version:
Operating System: macOS BigSur 11.6
What parser are you using?
Default (Espree)
What did you do?
Configuration
package.json
What did you expect to happen?
expected it to format to:
What actually happened?
Participation
Additional comments
when adding the airbnb extension it tries to merge both imports
The text was updated successfully, but these errors were encountered: