eslint-plugin-import-x
eslint-plugin-import-x copied to clipboard
Rule `newline-after-import` conflicates with prettier
ESLint config
import { defineConfig } from 'eslint/config'
import pluginImportX from 'eslint-plugin-import-x'
export default defineConfig([
{
plugins: {
'import-x': pluginImportX,
},
rules: {
'import-x/newline-after-import': 'error',
},
},
])
Source code
import prettier from 'prettier'
;(() => {})()
ESLint expected output
ESLint consider the code from import to ; as an ImportDeclaration and requires a newline after ; .
import prettier from 'prettier'
;
(() => {})()
Prettier expected output
Prettier treat the IIFE with semi as a whole part and want to delete the newline before it.
import prettier from 'prettier'
;(() => {})()
Repro repo
https://github.com/ntnyq/import-x-and-prettier