Closed zeromask1337 closed 2 weeks ago
Hello,
you are writing about @typescript-eslint/no-unused-vars
but your logs outputting @typescript-eslint/no-explicit-any
.
Can you show me more about the .oxlintrc.json
, I need to know what categories and plugins you defined and if the rule is specificly enabled in your .oxlintrc.json
.
My bad, issue was originally about no-explicit-any
Oxlint config
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
// "categories": {
// "correctness": "off",
// "nursery": "off",
// "pedantic": "off",
// "perf": "off",
// "restriction": "off",
// "style": "off",
// "suspicious": "off"
// },
"rules": {
"no-unused-vars": "error",
"no-console": "off",
"no-explicit-any": "error",
"prefer-as-const": "error",
"no-dynamic-delete": "error",
"no-var-requires": "error"
}
}
eslint config
// @ts-check
import { buildFromOxlintConfigFile } from 'eslint-plugin-oxlint'
import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt(
{
files: ['**/*.ts', '**/*.vue'],
rules: {
'no-console': 'off',
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@typescript-eslint/no-unused-vars': ['error', {
caughtErrors: 'none',
}],
'@typescript-eslint/no-extraneous-class': 'off',
'vue/max-attributes-per-line': [
'error',
{
singleline: {
max: 2,
},
multiline: {
max: 1,
},
},
],
'vue/component-name-in-template-casing': [
'error',
'PascalCase',
{
// registeredComponentsOnly: false,
ignores: ['nuxt-link'],
},
],
'vue/attributes-order': [
'error',
{
order: [
// 'is', 'v-is'
'DEFINITION',
// 'v-for'
'LIST_RENDERING',
// 'v-if', 'v-else-if', 'v-else', 'v-show', 'v-cloak'
'CONDITIONALS',
// 'v-once', 'v-pre'
'RENDER_MODIFIERS',
// 'id'
'GLOBAL',
// 'ref', 'key' | 'v-slot', 'slot'
['UNIQUE', 'SLOT'],
// 'v-model'
'TWO_WAY_BINDING',
// 'v-custom-directive'
'OTHER_DIRECTIVES',
// 'boolean-prop'
'ATTR_SHORTHAND_BOOL',
// 'prop="foo"', 'custom-prop="foo"'
'ATTR_STATIC',
// 'v-bind:prop="foo"', ':prop="foo"'
'ATTR_DYNAMIC',
// '@click="functionCall"', 'v-on="event"'
'EVENTS',
// 'v-text', 'v-html'
'CONTENT',
],
alphabetical: true,
},
],
'vue/html-self-closing': [
'error',
{
html: {
void: 'any',
normal: 'always',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
'import/named': 'off',
'vue/html-indent': [
'error',
2,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: [],
},
],
'vue/component-definition-name-casing': ['error', 'PascalCase'],
'vue/match-component-file-name': [
'warn',
{
extensions: ['vue'],
shouldMatchCase: false,
},
],
'vue/order-in-components': [
'error',
{
order: [
'el',
'name',
'key',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
['provide', 'inject'],
'ROUTER_GUARDS',
'layout',
'middleware',
'validate',
'scrollToTop',
'transition',
'loading',
'inheritAttrs',
'model',
['props', 'propsData'],
'emits',
'setup',
'asyncData',
'data',
'fetch',
'head',
'computed',
'watch',
'watchQuery',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError',
],
},
],
'no-void': ['error', { allowAsStatement: true }],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true }],
},
},
...buildFromOxlintConfigFile('./.oxlintrc.json'),
)
buildFromOxlintConfigFile
expects that only @typescript-eslint/no-explicit-any
works for oxlint
.
Currently the following are allowed:
no-explicit-any
typescript/no-explicit-any
@typescript-eslint/no-explicit-any
@DonIsaac is this expected and is the same for other plugins too?
Some of the typescript-extended rules are inherently supported by oxlint
and thus are only advertised as a single rule.
It's a bit annoying having to match rules when they are different names.
@drvn-mr moved your issue to a own ticket.
This issue is about the different supported names in oxlint
.
~~After reading the source code I don't think no-explicit-any
should do anything. There is no eslint
version of it but let me double check it with another person :) ~~
EDIT: this is expected in oxlint and a bug in this library. thanks for reporting
My eslint config has typescript rule
eslint-plugin-oxlint is configured in eslint.config
When I run
npx oxlint -c .oxlintrc.json || npx eslint
unused var rule appear both in oxlint and eslint log. Same file, same line.oxlint log
eslint log