feat(oxlint-config): enhacne rules and plugins#172
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the oxlint-config package to enable additional plugins in overrides, refine several rule configurations, and extend the custom @trigen/oxlint-config plugin with a new rule to enforce type-import style and merging behavior.
Changes:
- Add/adjust override-level
pluginsdeclarations so rule namespaces (e.g.,import/*,jsdoc/*,typescript/*,react/*) are consistently available where used. - Update TypeScript/React/basic rule settings (e.g.,
typescript/no-invalid-void-typeoptions,react/jsx-curly-brace-presenceoptions, naming convention allowances). - Add a new custom rule
trigen/type-import-styleand refine import-order / named-import-order plugin behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/oxlint-config/src/test.js | Adds TypeScript plugin + additional rule disables for test files. |
| packages/oxlint-config/src/subconfigs/typescript.js | Enhances TS rules (type imports + void type options) and enables plugins for .d.ts overrides. |
| packages/oxlint-config/src/subconfigs/typescript-type-checked.js | Removes consistent-type-imports from the type-checked layer. |
| packages/oxlint-config/src/subconfigs/react.stylistic.js | Adjusts react/jsx-curly-brace-presence configuration to a more granular option object. |
| packages/oxlint-config/src/subconfigs/react.js | Ensures jsdoc plugin is enabled for JSX override that configures jsdoc/* rules. |
| packages/oxlint-config/src/subconfigs/jsdoc.js | Adds jsdoc plugin to the TS override so the override’s jsdoc/* rules are resolvable. |
| packages/oxlint-config/src/subconfigs/configs.js | Enables import plugin for config-file overrides using import/* rules. |
| packages/oxlint-config/src/subconfigs/basic.js | Tweaks eslint/no-void and naming-convention settings (e.g., trailing $ allowances). |
| packages/oxlint-config/src/storybook.js | Enables import/react/typescript plugins for story overrides using those rule namespaces. |
| packages/oxlint-config/src/plugin/type-import-style.js | Introduces new custom rule to prefer import type and merge type/value imports. |
| packages/oxlint-config/src/plugin/named-import-order.js | Normalizes $-wrapped names when matching ordering patterns. |
| packages/oxlint-config/src/plugin/index.js | Registers the new type-import-style rule in the plugin exports. |
| packages/oxlint-config/src/plugin/import-order.js | Adjusts import ordering logic (notably newline checks and item selection/fixing behavior). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
163
to
+166
| function getImportItems(imports, options) { | ||
| return imports.map((node, index) => ({ | ||
| index, | ||
| node, | ||
| rank: getRank(node, options) | ||
| })) | ||
| return imports | ||
| .filter(node => node.specifiers.length > 0) | ||
| .map((node, index) => ({ |
Comment on lines
234
to
236
| function canFix(sourceCode, items) { | ||
| return !hasSideEffectImports(items) | ||
| && !hasInnerComments(sourceCode, items) | ||
| return !hasInnerComments(sourceCode, items) | ||
| } |
Comment on lines
+1
to
+6
| function shouldConvert(node) { | ||
| return node.importKind !== 'type' | ||
| && node.specifiers.length > 0 | ||
| && node.specifiers.every(specifier => specifier.type === 'ImportSpecifier' | ||
| && specifier.importKind === 'type') | ||
| } |
Comment on lines
+31
to
+40
| function canMerge(sourceCode, typeNode, valueNode) { | ||
| return typeNode.source.value === valueNode.source.value | ||
| && isTypeImport(typeNode) | ||
| && isNamedImport(typeNode) | ||
| && isNamedImport(valueNode) | ||
| && !isTypeImport(valueNode) | ||
| && !hasImportAttributes(typeNode) | ||
| && !hasImportAttributes(valueNode) | ||
| && !hasCommentsBetween(sourceCode, typeNode, valueNode) | ||
| } |
Comment on lines
+164
to
+169
| 'eslint/no-void': [ | ||
| 'off', | ||
| { | ||
| allowAsStatement: true | ||
| } | ||
| ], |
Comment on lines
+14
to
15
| plugins: ['typescript'], | ||
| rules: { |
Comment on lines
353
to
+356
| const unorderedPair = getFirstUnorderedPair(items) | ||
| const invalidNewlines = hasInvalidNewlines(items, options) | ||
| const invalidNewlinePair = getInvalidNewlinePair(sourceCode, items, options) | ||
|
|
||
| if (!unorderedPair && !invalidNewlines) { | ||
| if (!unorderedPair && !invalidNewlinePair) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.