linter: import/extensions rule should have mjs/mts/cjs/cts options
.mjs, .mts, .cjs, and .cts are valid, somewhat-common extensions for JavaScript/TypeScript code. Currently, import/extensions does not allow specifying anything of them. The original ESLint rule allows arbitrary values, so some projects migrating over will run into a potential incompatibility here.
Note that when implementing this, ensure that the way we check for extensions does not result in the rule for js overriding the rule for mjs (because if you just check for "does the filename end with 'js'?", mjs files would also be returned.
https://github.com/oxc-project/oxc/blob/25d577e274a680a785902eca6901d0ec38c801f0/crates/oxc_linter/src/rules/import/extensions.rs
the airbnb config sets mjs as a default value as well, so this is probably very common: https://github.com/airbnb/javascript/blob/0e2ef178a26ba9ac3495402a182891ad8096d3a0/packages/eslint-config-airbnb-base/rules/imports.js#L142
hmm, maybe .vue, .astro, .svelte, and .css as well?
And/or an escape hatch for "all other problematic cases? e.g. right now if you have this set to never allow extensions:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["import"],
"rules": {
"import/extensions": ["error", "never"]
}
}
Then you can't use .css imports, even though you do need extensions for those in many cases. And there's no way to make this work as-is.
This will be fixed by #14602