@mastermunj/oxc-config
Advanced tools
| import { defineConfig } from 'oxfmt'; | ||
| export default defineConfig({ | ||
| singleQuote: true, | ||
| printWidth: 120, | ||
| sortPackageJson: { | ||
| sortScripts: true, | ||
| }, | ||
| ignorePatterns: ['**/dist/**', '**/build/**', 'coverage/**', '*.min.js'], | ||
| }); |
| import { defineConfig } from 'oxlint'; | ||
| export default defineConfig({ | ||
| plugins: ['eslint', 'typescript', 'unicorn', 'import', 'oxc', 'vitest'], | ||
| env: { | ||
| node: true, | ||
| es2022: true, | ||
| }, | ||
| options: { | ||
| typeAware: true, | ||
| typeCheck: true, | ||
| }, | ||
| ignorePatterns: [ | ||
| '*.min.*', | ||
| '**/node_modules/**', | ||
| '**/dist/**', | ||
| '**/build/**', | ||
| '**/*.d.ts', | ||
| 'coverage/**', | ||
| 'output/**', | ||
| 'temp/**', | ||
| 'package-lock.json', | ||
| ], | ||
| rules: { | ||
| curly: ['error', 'all'], | ||
| eqeqeq: ['error', 'always'], | ||
| 'no-array-constructor': 'error', | ||
| 'no-await-in-loop': 'off', | ||
| 'unicorn/no-array-sort': 'off', | ||
| 'no-caller': 'error', | ||
| 'no-cond-assign': ['error', 'except-parens'], | ||
| 'no-constant-condition': 'error', | ||
| 'no-console': 'off', | ||
| 'no-control-regex': 'error', | ||
| 'no-debugger': 'error', | ||
| 'no-duplicate-case': 'error', | ||
| 'no-eval': 'error', | ||
| 'no-ex-assign': 'error', | ||
| 'no-extra-boolean-cast': 'error', | ||
| 'no-fallthrough': 'error', | ||
| 'no-inner-declarations': 'error', | ||
| 'no-invalid-regexp': ['error', { allowConstructorFlags: ['u', 'y'] }], | ||
| 'no-irregular-whitespace': 'error', | ||
| 'no-new-wrappers': 'error', | ||
| 'no-self-assign': 'error', | ||
| 'no-self-compare': 'error', | ||
| 'no-shadow': 'off', | ||
| 'no-sparse-arrays': 'error', | ||
| 'no-this-before-super': 'error', | ||
| 'no-unreachable': 'error', | ||
| 'no-unsafe-finally': 'error', | ||
| 'no-unsafe-negation': 'error', | ||
| 'no-with': 'error', | ||
| 'use-isnan': 'error', | ||
| 'valid-typeof': ['error', { requireStringLiterals: true }], | ||
| 'typescript/consistent-type-imports': [ | ||
| 'error', | ||
| { | ||
| fixStyle: 'inline-type-imports', | ||
| disallowTypeAnnotations: false, | ||
| }, | ||
| ], | ||
| 'typescript/switch-exhaustiveness-check': 'off', | ||
| 'unicorn/prefer-node-protocol': 'error', | ||
| 'unicorn/filename-case': [ | ||
| 'error', | ||
| { | ||
| cases: { | ||
| camelCase: true, | ||
| pascalCase: true, | ||
| kebabCase: true, | ||
| snakeCase: true, | ||
| }, | ||
| ignore: ['^[a-z]{2,3}-[A-Z]{2,3}(.test)?\\.(ts|js)$'], | ||
| }, | ||
| ], | ||
| 'unicorn/no-await-expression-member': 'error', | ||
| 'unicorn/no-instanceof-builtins': 'error', | ||
| 'unicorn/prefer-number-properties': 'error', | ||
| 'typescript/no-unused-vars': [ | ||
| 'error', | ||
| { | ||
| vars: 'all', | ||
| args: 'after-used', | ||
| argsIgnorePattern: '^_', | ||
| varsIgnorePattern: '^_', | ||
| }, | ||
| ], | ||
| }, | ||
| overrides: [ | ||
| { | ||
| files: ['**/*.{spec,test}.{ts,js}', '**/test/**', '**/__tests__/**'], | ||
| rules: { | ||
| 'typescript/no-explicit-any': 'off', | ||
| }, | ||
| }, | ||
| ], | ||
| }); |
+11
-10
| { | ||
| "name": "@mastermunj/oxc-config", | ||
| "version": "0.0.5", | ||
| "version": "0.0.6", | ||
| "description": "Shared oxlint + oxfmt configuration for TypeScript packages", | ||
@@ -24,8 +24,9 @@ "keywords": [ | ||
| "files": [ | ||
| ".oxlintrc.json", | ||
| ".oxfmtrc.json" | ||
| "oxlint.config.ts", | ||
| "oxfmt.config.ts" | ||
| ], | ||
| "type": "module", | ||
| "exports": { | ||
| "./oxlint": "./.oxlintrc.json", | ||
| "./oxfmt": "./.oxfmtrc.json" | ||
| "./oxlint": "./oxlint.config.ts", | ||
| "./oxfmt": "./oxfmt.config.ts" | ||
| }, | ||
@@ -39,3 +40,3 @@ "publishConfig": { | ||
| "format:report": "node ./scripts/format_report.mjs", | ||
| "lint": "oxlint --type-aware .", | ||
| "lint": "oxlint .", | ||
| "lint:fix": "npm run lint -- --fix", | ||
@@ -46,7 +47,7 @@ "release": "commit-and-tag-version", | ||
| "devDependencies": { | ||
| "commit-and-tag-version": "^13.0.0", | ||
| "oxfmt": "^0.59.0", | ||
| "oxlint": "^1.74.0", | ||
| "oxlint-tsgolint": "^0.25.0" | ||
| "commit-and-tag-version": "^13.1.0", | ||
| "oxfmt": "^0.60.0", | ||
| "oxlint": "^1.75.0", | ||
| "oxlint-tsgolint": "^7.0.2001" | ||
| } | ||
| } |
+59
-44
@@ -7,5 +7,5 @@ # @mastermunj/oxc-config | ||
| - Shareable `oxlint` base config | ||
| - Shareable `oxlint` base config with type-aware linting (tsgolint) | ||
| - Shareable `oxfmt` base config | ||
| - A simple starting point that teams can customize per package | ||
| - TypeScript-first: fully typed, composable via `extends` / spread | ||
@@ -15,3 +15,3 @@ ## Install | ||
| ```sh | ||
| npm install --save-dev @mastermunj/oxc-config oxlint oxfmt oxlint-tsgolint@latest | ||
| npm install --save-dev @mastermunj/oxc-config oxlint oxfmt oxlint-tsgolint | ||
| ``` | ||
@@ -23,8 +23,11 @@ | ||
| Create `.oxlintrc.json` in your project root: | ||
| Create `oxlint.config.ts` in your project root: | ||
| ```json | ||
| { | ||
| "extends": ["./node_modules/@mastermunj/oxc-config/.oxlintrc.json"] | ||
| } | ||
| ```ts | ||
| import { defineConfig } from 'oxlint'; | ||
| import baseConfig from '@mastermunj/oxc-config/oxlint'; | ||
| export default defineConfig({ | ||
| extends: [baseConfig], | ||
| }); | ||
| ``` | ||
@@ -34,22 +37,22 @@ | ||
| Yes, you can both override existing rules and add new rules. | ||
| Pass additional rules or overrides after `extends`: | ||
| Example: | ||
| ```ts | ||
| import { defineConfig } from 'oxlint'; | ||
| import baseConfig from '@mastermunj/oxc-config/oxlint'; | ||
| ```json | ||
| { | ||
| "extends": ["./node_modules/@mastermunj/oxc-config/.oxlintrc.json"], | ||
| "rules": { | ||
| "typescript/no-explicit-any": "warn", | ||
| "no-console": "error" | ||
| export default defineConfig({ | ||
| extends: [baseConfig], | ||
| rules: { | ||
| 'no-console': 'error', | ||
| }, | ||
| "overrides": [ | ||
| overrides: [ | ||
| { | ||
| "files": ["scripts/**/*.ts"], | ||
| "rules": { | ||
| "eslint/no-console": "off" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| files: ['scripts/**/*.ts'], | ||
| rules: { | ||
| 'no-console': 'off', | ||
| }, | ||
| }, | ||
| ], | ||
| }); | ||
| ``` | ||
@@ -59,18 +62,38 @@ | ||
| Use the shared formatter config via `--config`: | ||
| Create `oxfmt.config.ts` in your project root: | ||
| ```sh | ||
| oxfmt --check --config ./node_modules/@mastermunj/oxc-config/.oxfmtrc.json . | ||
| oxfmt --write --config ./node_modules/@mastermunj/oxc-config/.oxfmtrc.json . | ||
| ```ts | ||
| import { defineConfig } from 'oxfmt'; | ||
| import baseConfig from '@mastermunj/oxc-config/oxfmt'; | ||
| export default defineConfig({ | ||
| ...baseConfig, | ||
| }); | ||
| ``` | ||
| ### 4) Scripts | ||
| ### 4) Customize formatter settings | ||
| Spread the base config and override only what you need: | ||
| ```ts | ||
| import { defineConfig } from 'oxfmt'; | ||
| import baseConfig from '@mastermunj/oxc-config/oxfmt'; | ||
| export default defineConfig({ | ||
| ...baseConfig, | ||
| printWidth: 100, | ||
| }); | ||
| ``` | ||
| ### 5) Scripts | ||
| Both tools auto-discover `oxlint.config.ts` and `oxfmt.config.ts` in the project root — no `--config` flag needed. | ||
| ```json | ||
| { | ||
| "scripts": { | ||
| "lint": "oxlint --type-aware .", | ||
| "lint:fix": "npm run lint -- --fix", | ||
| "format": "oxfmt --check --config ./node_modules/@mastermunj/oxc-config/.oxfmtrc.json .", | ||
| "format:fix": "oxfmt --write --config ./node_modules/@mastermunj/oxc-config/.oxfmtrc.json ." | ||
| "lint": "oxlint .", | ||
| "lint:fix": "oxlint --fix .", | ||
| "format": "oxfmt --check .", | ||
| "format:fix": "oxfmt --write ." | ||
| } | ||
@@ -80,16 +103,8 @@ } | ||
| ### 5) Customize formatter settings | ||
| > **Type-aware linting** is enabled automatically via `options.typeAware: true` in the base config (powered by tsgolint). No `--type-aware` CLI flag needed. | ||
| `oxfmt` does not currently support deep config inheritance like lint `extends` in the same way. | ||
| Recommended approach: | ||
| - Start from the shared config file | ||
| - Copy into your package as `.oxfmtrc.json` | ||
| - Adjust only settings you want to change | ||
| ## Package Exports | ||
| - `@mastermunj/oxc-config/oxlint` | ||
| - `@mastermunj/oxc-config/oxfmt` | ||
| - `@mastermunj/oxc-config/oxlint` → `oxlint.config.ts` | ||
| - `@mastermunj/oxc-config/oxfmt` → `oxfmt.config.ts` | ||
@@ -96,0 +111,0 @@ ## License |
| { | ||
| "$schema": "./node_modules/oxfmt/configuration_schema.json", | ||
| "singleQuote": true, | ||
| "printWidth": 120, | ||
| "sortPackageJson": { | ||
| "sortScripts": true | ||
| }, | ||
| "ignorePatterns": ["**/dist/**", "**/build/**", "coverage/**", "*.min.js"] | ||
| } |
| { | ||
| "$schema": "./node_modules/oxlint/configuration_schema.json", | ||
| "plugins": ["eslint", "typescript", "unicorn", "import", "oxc", "vitest"], | ||
| "env": { | ||
| "node": true, | ||
| "es2022": true | ||
| }, | ||
| "ignorePatterns": [ | ||
| "*.min.*", | ||
| "**/node_modules/**", | ||
| "**/dist/**", | ||
| "**/build/**", | ||
| "**/*.d.ts", | ||
| "coverage/**", | ||
| "output/**", | ||
| "temp/**", | ||
| "package-lock.json" | ||
| ], | ||
| "rules": { | ||
| "curly": ["error", "all"], | ||
| "eqeqeq": ["error", "always"], | ||
| "no-array-constructor": "error", | ||
| "no-await-in-loop": "off", | ||
| "unicorn/no-array-sort": "off", | ||
| "no-caller": "error", | ||
| "no-cond-assign": ["error", "except-parens"], | ||
| "no-constant-condition": "error", | ||
| "no-console": "off", | ||
| "no-control-regex": "error", | ||
| "no-debugger": "error", | ||
| "no-duplicate-case": "error", | ||
| "no-eval": "error", | ||
| "no-ex-assign": "error", | ||
| "no-extra-boolean-cast": "error", | ||
| "no-fallthrough": "error", | ||
| "no-inner-declarations": "error", | ||
| "no-invalid-regexp": ["error", { "allowConstructorFlags": ["u", "y"] }], | ||
| "no-irregular-whitespace": "error", | ||
| "no-new-wrappers": "error", | ||
| "no-self-assign": "error", | ||
| "no-self-compare": "error", | ||
| "no-shadow": "off", | ||
| "no-sparse-arrays": "error", | ||
| "no-this-before-super": "error", | ||
| "no-unreachable": "error", | ||
| "no-unsafe-finally": "error", | ||
| "no-unsafe-negation": "error", | ||
| "no-with": "error", | ||
| "use-isnan": "error", | ||
| "valid-typeof": ["error", { "requireStringLiterals": true }], | ||
| "typescript/consistent-type-imports": [ | ||
| "error", | ||
| { | ||
| "fixStyle": "inline-type-imports", | ||
| "disallowTypeAnnotations": false | ||
| } | ||
| ], | ||
| "typescript/switch-exhaustiveness-check": "off", | ||
| "unicorn/prefer-node-protocol": "error", | ||
| "unicorn/filename-case": [ | ||
| "error", | ||
| { | ||
| "cases": { | ||
| "camelCase": true, | ||
| "pascalCase": true, | ||
| "kebabCase": true, | ||
| "snakeCase": true | ||
| }, | ||
| "ignore": ["^[a-z]{2,3}-[A-Z]{2,3}(.test)?\\.(ts|js)$"] | ||
| } | ||
| ], | ||
| "unicorn/no-await-expression-member": "error", | ||
| "unicorn/no-instanceof-builtins": "error", | ||
| "unicorn/prefer-number-properties": "error", | ||
| "typescript/no-unused-vars": [ | ||
| "error", | ||
| { | ||
| "vars": "all", | ||
| "args": "after-used", | ||
| "argsIgnorePattern": "^_", | ||
| "varsIgnorePattern": "^_" | ||
| } | ||
| ] | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["**/*.{spec,test}.{ts,js}", "**/test/**", "**/__tests__/**"], | ||
| "rules": { | ||
| "typescript/no-explicit-any": "off" | ||
| } | ||
| } | ||
| ] | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
7279
4.64%106
3.92%108
16.13%Yes
NaN1
Infinity%