@igorskyflyer/oxlint-config
v1.1.0
Published
⚓ Strict, no-nonsense oxlint rules that catch real bugs and enforce clean code. 🐳
Downloads
40
Maintainers
Readme
Table of Contents
- ✨ Features
- 🕵🏼 Usage
- ⚙️ Implementation
- 🎯 Motivation
- 📝 Changelog
- 🪪 License
- 💖 Support
- 🧬 Related
- 👨🏻💻 Author
Features
- ⚓ Strict, opinionated oxlint config for modern
JavaScriptandTypeScriptprojects - 🔍 Catches unused variables, imports, explicit
any, floating promises and unsafe assignments - 📦 Covers
typescript,import,node,promise,unicorn,jestandvitestplugins - 🚀
node:protocol enforced, barrel files flagged, accumulating spreads detected - 🔄 Import cycle, duplicate and absolute path detection built-in
- 🧪 Vitest-aware rules - no focused, disabled or conditionally skipped tests slip through
- 🦄 Unicorn rules for modern idioms -
prefer-at,prefer-includes,numeric-separatorsand more - 🛡️ Zero bikeshedding - one config, all projects, extend and go
Usage
Install it by executing any of the following, depending on the preferred package manager:
bun add -D @igorskyflyer/oxlint-configpnpm add -D @igorskyflyer/oxlint-configyarn add -D @igorskyflyer/oxlint-confignpm i -D @igorskyflyer/oxlint-configThen extend the config in .oxlintrc.json:
.oxlintrc.json
{
"extends": ["@igorskyflyer/oxlint-config"]
}Override any rule locally as needed:
.oxlintrc.json
{
"extends": ["@igorskyflyer/oxlint-config"],
"rules": {
"no-console": "error"
}
}Implementation
Options
typeAware: false- disabled by default - requires theoxlint-tsgolintpeer dependency, enable locally when available for deeper type-aware analysisdenyWarnings: false- warnings do not produce a non-zero exit code, keeping CI pipelines unblocked for non-critical issuesreportUnusedDisableDirectives: "warn"- flags stale// oxlint-disablecomments that no longer suppress anything
Plugins
typescript- type safety, imports, class members and unsafe assignment detectionimport- clean import hygiene - no duplicates, no cycles, no absolute pathsnode- Node.js-specific rules includingnode:protocol enforcementpromise- catches common Promise misuse patterns and anti-patternsunicorn- modern idioms -prefer-at,prefer-includes, numeric separators and morejest- shared test rules used by both Jest and Vitest in oxlintvitest- Vitest-specific rules on top of the jest plugin
Rules
General:
no-console: "warn"- console statements are development artifacts, not production codeno-undef: "error"- referencing undefined variables is always a bugno-unused-vars: "error"- unused variables are dead code and signal incomplete refactorsno-unused-expressions: "error"- expressions with no effect are always a bug or dead codeno-unused-private-class-members: "error"- unused private members are dead codeno-shadow: "warn"- shadowed variables cause subtle, hard-to-spot bugsno-await-in-loop: "warn"- awaiting in loops is almost always a performance mistakeno-constructor-return: "error"- returning from a constructor is always wrongno-promise-executor-return: "error"- returning from a Promise executor is a bugno-self-compare: "error"- comparing a value to itself is always a bugno-template-curly-in-string: "warn"-"${var}"instead of`${var}`is a common typono-new: "warn"- usingnewpurely for side effects is suspiciousno-extend-native: "error"- extending native prototypes breaks the ecosystemno-new-wrappers: "error"-new String()and friends are never correctno-proto: "error"-__proto__is deprecated, useObject.getPrototypeOf()insteadno-var: "error"-varis obsolete, useconstorletno-eval: "error"-evalis a security vulnerabilityno-implied-eval: "error"-setTimeout("code")isevalin disguiseprefer-const: "error"- prefer immutability by defaulteqeqeq: "error"- always use strict equalityrequire-await: "error"- async functions withoutawaitare misleadingrequire-yield: "error"- generators withoutyieldare pointless
TypeScript:
typescript/no-explicit-any: "error"-anydefeats the purpose of TypeScript entirelytypescript/no-inferrable-types: "off"- explicit types on inferrable values are allowed, clarity over brevitytypescript/consistent-type-imports: "error"- enforcesimport typefor type-only imports, reduces runtime overheadtypescript/consistent-generic-constructors: "error"- consistent placement of generic type annotationstypescript/adjacent-overload-signatures: "error"- overload signatures must be grouped together for readabilitytypescript/no-misused-promises: "error"- passing async functions where sync is expected causes subtle bugstypescript/no-floating-promises: "error"- unhandled promises are silent failurestypescript/no-unnecessary-type-assertion: "warn"- redundant type assertions add noisetypescript/no-unnecessary-boolean-literal-compare: "warn"-x === trueis redundanttypescript/no-unsafe-assignment: "error"- preventsanyfrom silently spreading through the codebasetypescript/no-unsafe-call: "error"- callinganytyped values is unsafetypescript/no-unsafe-member-access: "error"- accessing members ofanytyped values is unsafetypescript/no-unsafe-return: "error"- returninganytyped values pollutes callerstypescript/await-thenable: "error"- awaiting non-thenables is always a bugtypescript/no-for-in-array: "error"-for...inon arrays produces unexpected resultstypescript/prefer-nullish-coalescing: "warn"-??is safer than||for nullish checkstypescript/prefer-includes: "error"-indexOf >= 0should beincludes()typescript/return-await: "error"- returning a promise inside try/catch requiresawaittypescript/only-throw-error: "error"- onlyErrorobjects should be throwntypescript/ban-ts-comment: "warn"-@ts-ignoresilences errors instead of fixing themtypescript/switch-exhaustiveness-check: "warn"- missing switch cases on union types are likely bugstypescript/no-array-delete: "error"- deleting array elements leaves holestypescript/no-base-to-string: "error"- calling.toString()on objects that return[object Object]typescript/no-duplicate-type-constituents: "error"- duplicate types in unions/intersections are noisetypescript/no-redundant-type-constituents: "error"- redundant type members simplify nothingtypescript/no-wrapper-object-types: "error"-String,Number,Booleanas types are wrongtypescript/prefer-as-const: "error"- useas constinstead of literal type assertionstypescript/restrict-template-expressions: "error"- prevents unsafe values in template literalstypescript/no-misused-spread: "error"- spreading non-iterable values causes runtime errors
Import:
import/no-duplicates: "error"- duplicate imports from the same module are redundantimport/no-self-import: "error"- a module importing itself is always a mistakeimport/no-cycle: "warn"- circular imports cause hard-to-debug runtime issuesimport/no-named-as-default: "warn"- importing a named export as default is likely a mistakeimport/no-absolute-path: "error"- absolute imports break portability across environmentsimport/no-empty-named-blocks: "error"-import {} from 'x'is completely pointless
Node:
node/no-new-require: "error"-new require()is never correctnode/no-path-concat: "error"- usepath.join()instead of string concatenation for pathsnode/no-process-env: "warn"- directprocess.envaccess should be centralized
Unicorn:
unicorn/prefer-node-protocol: "error"- always usenode:prefix for built-insunicorn/no-useless-promise-resolve-reject: "error"- wrapping inPromise.resolve/rejectinside async is redundantunicorn/no-unnecessary-await: "error"- awaiting a non-promise is pointlessunicorn/prefer-string-starts-ends-with: "error"- cleaner thanindexOforslicechecksunicorn/error-message: "error"- errors must always have a messageunicorn/no-instanceof-array: "error"- useArray.isArray()insteadunicorn/throw-new-error: "error"- always usenewwhen throwing errorsunicorn/prefer-includes: "error"-indexOf >= 0should beincludes()unicorn/no-array-for-each: "warn"- preferfor...ofover.forEach()unicorn/prefer-at: "error"-arr[arr.length - 1]should bearr.at(-1)unicorn/no-typeof-undefined: "error"-typeof x === 'undefined'should bex === undefinedunicorn/prefer-string-slice: "error"-substr/substringare deprecated, usesliceunicorn/no-useless-undefined: "error"- explicitreturn undefinedis implicitunicorn/no-nested-ternary: "error"- nested ternaries are unreadableunicorn/prefer-ternary: "off"- prefer usingif/elsefor readabilityunicorn/numeric-separators-style: "error"-1000000should be1_000_000unicorn/prefer-date-now: "error"-new Date().getTime()should beDate.now()unicorn/no-static-only-class: "error"- use a plain object instead of a static-only classunicorn/no-array-reduce: "warn"-reduceis often harder to read than a loopunicorn/no-single-promise-in-promise-methods: "error"-Promise.all([x])should just beawait xunicorn/no-useless-fallback-in-spread: "error"-[...(x || [])]is redundant whenxis always iterableunicorn/prefer-string-replace-all: "error"- usereplaceAllinstead ofreplacewith a global regexunicorn/prefer-array-flat-map: "error"-.map().flat()should be.flatMap()unicorn/no-empty-file: "error"- empty files are always dead codeunicorn/no-thenable: "error"- objects with.then()are accidentally treated as promisesunicorn/prefer-set-size: "error"- useset.sizeinstead of[...set].lengthunicorn/prefer-set-has: "warn"-Set.has()is O(1) vsArray.includes()O(n)unicorn/no-await-in-promise-methods: "error"-Promise.all([await x])defeats the purposeunicorn/custom-error-definition": "error": "error"- enforces the only valid way ofErrorsubclassing
OXC:
oxc/bad-array-method-on-arguments: "error"-argumentsis not a real arrayoxc/bad-comparison-sequence: "error"-a < b < cdoes not work as expectedoxc/missing-throw: "error"-new Error()withoutthrowis always a bugoxc/no-accumulating-spread: "warn"- spreading inside a loop has O(n²) complexityoxc/no-barrel-file: "warn"- barrel files hurt tree-shaking and build performanceoxc/double-comparisons: "error"- redundant double comparisonsoxc/bad-min-max-func: "error"- incorrect use ofMath.min/Math.maxoxc/bad-object-literal-comparison: "error"- comparing object literals is alwaysfalseoxc/const-comparisons: "error"- comparisons that are always true or falseoxc/erasing-op: "error"- operations that always erase their operandoxc/only-used-in-recursion: "warn"- parameters only used in recursion can be simplified
Promise:
promise/no-return-wrap: "error"- wrapping inPromise.resolve()inside async is redundantpromise/param-names: "error"- Promise constructor params must be namedresolveandrejectpromise/no-multiple-resolved: "error"- resolving or rejecting a Promise more than once is a bugpromise/valid-params: "error"- Promise methods must receive the correct number of argumentspromise/no-callback-in-promise: "warn"- using callbacks inside Promise chains causes unpredictable behaviorpromise/no-nesting: "warn"- nested.then()chains should useasync/awaitpromise/no-promise-in-callback: "warn"- using Promises inside callbacks causes unpredictable behavior
Jest/Vitest:
jest/no-disabled-tests: "warn"- disabled tests are technical debtjest/no-focused-tests: "error"-test.onlymust never reach production CIjest/consistent-test-it: "error"- enforces consistent use oftestoritjest/no-identical-title: "error"- duplicate test titles make failures impossible to distinguishjest/valid-title: "error"- test titles must be valid and meaningfuljest/valid-expect: "error"-expect()must be called correctlyjest/no-conditional-expect: "error"- conditional expects hide test failuresjest/no-standalone-expect: "error"-expect()outside a test block is always a bugjest/require-to-throw-message: "error"-toThrow()without a message is too broadjest/valid-describe-callback: "error"- describe callbacks must be valid functionsvitest/no-conditional-tests: "error"- conditional tests hide failuresvitest/hoisted-apis-on-top: "warn"-vi.mock()and similar must be hoistedvitest/warn-todo: "warn"- todo tests signal unfinished workvitest/consistent-each-for: "error"- consistent use ofeachfor parameterized testsvitest/prefer-strict-boolean-matchers: "error"- enforce usingtoBe(true)andtoBe(false)over matchers that coerce types to boolean
Motivation
Every project deserves consistent, battle-tested linting from day one - not a config assembled from memory, copy-pasted from a previous project or missing half the plugins.
@igorskyflyer/oxlint-config provides a single, versioned, opinionated baseline covering seven plugin ecosystems. Drop it in, extend if needed, and focus on the actual code.
Changelog
Read about the latest changes in the CHANGELOG.
License
Licensed under the MIT license.
Support
Related
This package is part of the dotfiles DX config suite - a curated index of independently installable configuration packages for linting, formatting, editing, JS/TS, React, Vue and many more.
Other related packages
@igorskyflyer/astro-render-component
🤖 Astro component renderer. Zero configuration. Produces clean HTML strings directly in Node.js without any DOM environment. 🐬
@igorskyflyer/adblock-filter-counter
🐲 A lightweight npm module for counting ad-block filter rules, ultra-simple, fast, and perfect for list maintainers, filter testers, and privacy tool developers.🦘
🧠 Zep is a zero-dependency, efficient debounce module. ⏰
🧵 An expressive and chainable library for advanced string manipulations. Supports appending, prepending, trimming, quoting, and path formatting with customizable whitespace handling. Makes advanced String manipulations a piece of cake. 🦥
🧰 Determines whether a given value can be a valid file/directory name. 🏜
Author
Created by Igor Dimitrijević (@igorskyflyer).
