Skip to content

Sort imports with dprint instead of eslint #58058

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

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
"constructorType.spaceAfterNewKeyword": true,
"constructSignature.spaceAfterNewKeyword": true,

// Let eslint-plugin-simple-import-sort handle this.
"module.sortImportDeclarations": "maintain",
"module.sortExportDeclarations": "maintain",
"exportDeclaration.sortNamedExports": "maintain",
"importDeclaration.sortNamedImports": "maintain"
"module.sortImportDeclarations": "caseInsensitive",
"module.sortExportDeclarations": "caseInsensitive",
"exportDeclaration.sortNamedExports": "caseInsensitive",
"importDeclaration.sortNamedImports": "caseInsensitive"
},
"prettier": {
"newLineKind": "lf",
Expand All @@ -53,7 +52,8 @@
"tests/**",
"internal/**",
"**/*.generated.*",
"scripts/*.d.*"
"scripts/*.d.*",
"**/_namespaces/**"
],
// Note: if adding new languages, make sure settings.template.json is updated too.
"plugins": [
Expand Down
17 changes: 2 additions & 15 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"plugins": [
"@typescript-eslint",
"no-null",
"eslint-plugin-local",
"simple-import-sort"
"eslint-plugin-local"
],
"ignorePatterns": [
"**/node_modules/**",
Expand Down Expand Up @@ -136,11 +135,7 @@
"local/jsdoc-format": "error",

// eslint-plugin-no-null
"no-null/no-null": "error",

// eslint-plugin-simple-import-sort
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
"no-null/no-null": "error"
},
"overrides": [
// By default, the ESLint CLI only looks at .js files. But, it will also look at
Expand All @@ -167,14 +162,6 @@
{ "name": "exports" }
]
}
},
{
// These files contain imports in a specific order that are generally unsafe to modify.
"files": ["**/_namespaces/**"],
"rules": {
"simple-import-sort/imports": "off",
"simple-import-sort/exports": "off"
}
}
]
}
8 changes: 5 additions & 3 deletions .vscode/settings.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
".git-blame-ignore-revs"
],

// Match eslint-plugin-simple-import-sort in organize/auto-imports.
// Match dprint in organize/auto-imports.
"typescript.unstable": {
"organizeImportsCollation": "unicode",
"organizeImportsCaseFirst": "upper",
"organizeImportsIgnoreCase": false,
"organizeImportsNumericCollation": true
"organizeImportsNumericCollation": true,
"organizeImportsTypeOrder": "inline"
},
"javascript.unstable": {
"organizeImportsCollation": "unicode",
"organizeImportsCaseFirst": "upper",
"organizeImportsIgnoreCase": false,
"organizeImportsNumericCollation": true
"organizeImportsNumericCollation": true,
"organizeImportsTypeOrder": "inline"
},

// These options search the repo recursively and slow down
Expand Down
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"eslint-formatter-autolinkable-stylish": "^1.3.0",
"eslint-plugin-local": "^4.2.1",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-simple-import-sort": "^12.0.0",
"fast-xml-parser": "^4.3.6",
"glob": "^10.3.10",
"hereby": "^1.8.9",
Expand Down