Skip to content

Commit 7158aa8

Browse files
Ditch the eslint-plugin-import and use Prettier to order imports (#3914)
1 parent 2f7b10d commit 7158aa8

File tree

4 files changed

+55
-351
lines changed

4 files changed

+55
-351
lines changed

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
{
22
"plugins": [
3+
"@trivago/prettier-plugin-sort-imports",
34
"prettier-plugin-brace-style",
45
"prettier-plugin-space-before-function-paren",
56
"prettier-plugin-merge"
67
],
8+
"importOrder": [
9+
"^(node:|fs|path|os|crypto|stream|http|https|zlib|url|util|assert|buffer|events|child_process|cluster|dns|net|tls|readline|repl|vm|worker_threads)",
10+
"^[a-z]",
11+
"^@/",
12+
"^\\.\\./",
13+
"^\\./",
14+
"^\\.$"
15+
],
16+
"importOrderSortSpecifiers": true,
17+
"importOrderCaseInsensitive": true,
718
"braceStyle": "stroustrup",
819
"arrowParens": "avoid",
920
"bracketSpacing": true,

eslint.config.mjs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import tsEslintParser from '@typescript-eslint/parser';
55
import { defineConfig } from 'eslint/config';
66
import eslintConfigPrettier from 'eslint-config-prettier/flat';
77
import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
8-
import importPlugin from 'eslint-plugin-import';
98
import jsdocPlugin from 'eslint-plugin-jsdoc';
109
import regexpPlugin from 'eslint-plugin-regexp';
1110
import globals from 'globals';
@@ -22,7 +21,6 @@ const config = [
2221
js.configs.recommended,
2322
{
2423
plugins: {
25-
import: importPlugin,
2624
jsdoc: jsdocPlugin,
2725
regexp: regexpPlugin,
2826
},
@@ -34,25 +32,6 @@ const config = [
3432
'no-use-before-define': ['warn', { 'functions': false, 'classes': false }],
3533
'eqeqeq': ['warn', 'always', { 'null': 'ignore' }],
3634

37-
// imports
38-
'import/extensions': ['warn', 'never'],
39-
'import/order': [
40-
'warn',
41-
{
42-
groups: [
43-
['builtin', 'external'],
44-
'internal',
45-
'parent',
46-
'sibling',
47-
'index',
48-
'object',
49-
'type',
50-
],
51-
alphabetize: { order: 'asc', caseInsensitive: true },
52-
},
53-
],
54-
'sort-imports': ['warn', { ignoreDeclarationSort: true }],
55-
5635
// stylistic rules
5736
'no-var': 'warn',
5837
'object-shorthand': ['warn', 'always', { avoidQuotes: true }],

0 commit comments

Comments
 (0)