@haltcase/style 9.0.0-canary.2 → 9.0.0-canary.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,6 +62,13 @@ Native Oxlint rules are enabled explicitly. Upgrading Oxlint does not automatica
62
62
  added rules; those are adopted through updates to `@haltcase/style`. Existing rules can still change
63
63
  behavior when Oxlint is upgraded.
64
64
 
65
+ Use `rules` to customize rules for all files and `overrides` to customize rules for matching files.
66
+ Top-level rules are applied in order from `extends` to presets (such as `node` or `react`) to
67
+ `rules`. Matching `overrides` take precedence over top-level rules, and user overrides take
68
+ precedence over preset overrides. Use `plugins` to add native plugins alongside the default and
69
+ preset plugins, and `jsPlugins` to load JavaScript plugins. `createOxlintConfig` supports explicit
70
+ rules instead of the `categories` option so new rules are enabled through preset updates.
71
+
65
72
  ### Oxfmt
66
73
 
67
74
  ```js
@@ -1,8 +1,8 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- import { toMerged } from "es-toolkit";
5
4
  import { isPackageExists } from "local-pkg";
5
+ import { toMerged } from "es-toolkit";
6
6
  // src/oxfmt/index.ts
7
7
  const defaults = {
8
8
  arrowParens: "always",
@@ -22,7 +22,7 @@ export declare const baseConfig: {
22
22
  "import/no-default-export"?: undefined;
23
23
  };
24
24
  })[];
25
- plugins: ("promise" | "eslint" | "unicorn" | "oxc" | "import" | "jsdoc")[];
25
+ plugins: ("promise" | "jsdoc" | "oxc" | "eslint" | "unicorn" | "import")[];
26
26
  jsPlugins: import("oxlint").ExternalPluginEntry[];
27
27
  rules: {
28
28
  "haltcase/padding-between-statements": "error";
@@ -453,7 +453,7 @@ export declare const baseConfig: {
453
453
  allowImplicit: true;
454
454
  }];
455
455
  "block-scoped-var": "error";
456
- curly: ["error", "multi-line"];
456
+ curly: ["error", "all"];
457
457
  "default-case-last": "error";
458
458
  "default-param-last": "error";
459
459
  eqeqeq: ["error", "always", {
@@ -2,7 +2,7 @@ import __tsdown_shims_path from 'node:path';
2
2
  import __tsdown_shims_url from 'node:url';
3
3
  import { OxlintConfig, OxlintOverride } from "oxlint";
4
4
  export declare const tanstackPackages: readonly ["@tanstack/react-router", "@tanstack/react-start", "@tanstack/eslint-plugin-router"];
5
- type OxlintPassthroughOptions = Omit<OxlintConfig, "overrides">;
5
+ type OxlintPassthroughOptions = Omit<OxlintConfig, "categories" | "overrides" | "plugins" | "rules">;
6
6
  export interface CreateOxlintConfigOptions extends OxlintPassthroughOptions {
7
7
  typescript?: boolean;
8
8
  react?: boolean;
@@ -22,9 +22,18 @@ export interface CreateOxlintConfigOptions extends OxlintPassthroughOptions {
22
22
  next?: boolean;
23
23
  node?: boolean;
24
24
  testing?: boolean;
25
+ /**
26
+ * Enable additional native plugins alongside the default and preset plugins.
27
+ */
28
+ plugins?: OxlintConfig["plugins"];
29
+ /**
30
+ * Configure rules for all files. These take precedence over rules set at the top level of
31
+ * extended configs and presets. Matching overrides take precedence over these rules.
32
+ */
33
+ rules?: OxlintConfig["rules"];
25
34
  /**
26
35
  * Add, remove, or otherwise reconfigure rules for specific files or groups of files.
27
- * These overrides supercede any rules configured by preset options (e.g., `node` or `react`).
36
+ * These overrides take precedence over matching preset overrides and top-level rules.
28
37
  */
29
38
  overrides?: OxlintOverride[];
30
39
  }
@@ -24,7 +24,7 @@ const tanstackPackages = [
24
24
  ];
25
25
  const typescriptPackages = ["@typescript/native-preview", "typescript"];
26
26
  const createOxlintConfig = (options = {}) => {
27
- const { env, extends: userExtends = [], globals, ignorePatterns: userIgnores = [], options: lintOptions, overrides = [], rules, settings, typescript: isTypescriptEnabled = typescriptPackages.some((pkg) => isPackageExists(pkg)), react: isReactEnabled = reactPackages.some((pkg) => isPackageExists(pkg)), tanstackRouter: isTanstackRouterEnabled = tanstackPackages.filter((pkg) => pkg !== "@tanstack/react-start").every((pkg) => isPackageExists(pkg)), tanstackStart: isTanstackStartEnabled = tanstackPackages.every((pkg) => isPackageExists(pkg)), next: isNextEnabled = isPackageExists("next"), node: isNodeEnabled = false, testing: isTestingEnabled = false } = options;
27
+ const { env, extends: userExtends = [], globals, ignorePatterns: userIgnores = [], jsPlugins, options: lintOptions, overrides = [], plugins: userPlugins, rules, settings, typescript: isTypescriptEnabled = typescriptPackages.some((pkg) => isPackageExists(pkg)), react: isReactEnabled = reactPackages.some((pkg) => isPackageExists(pkg)), tanstackRouter: isTanstackRouterEnabled = tanstackPackages.filter((pkg) => pkg !== "@tanstack/react-start").every((pkg) => isPackageExists(pkg)), tanstackStart: isTanstackStartEnabled = tanstackPackages.every((pkg) => isPackageExists(pkg)), next: isNextEnabled = isPackageExists("next"), node: isNodeEnabled = false, testing: isTestingEnabled = false } = options;
28
28
  const configs = [...userExtends, ...baseConfig];
29
29
  if (isTypescriptEnabled) configs.push(...typescriptConfig);
30
30
  if (isReactEnabled) configs.push(...reactConfig);
@@ -33,11 +33,13 @@ const createOxlintConfig = (options = {}) => {
33
33
  if (isNextEnabled) configs.push(...nextConfig);
34
34
  if (isTanstackRouterEnabled) configs.push(...tanstackRouterConfig);
35
35
  if (isTanstackStartEnabled) configs.push(...tanstackStartConfig);
36
+ if (userPlugins) configs.push({ plugins: userPlugins });
36
37
  return {
37
38
  env,
38
39
  extends: configs,
39
40
  globals,
40
41
  ignorePatterns: [...userIgnores],
42
+ jsPlugins,
41
43
  overrides,
42
44
  options: {
43
45
  typeAware: isTypescriptEnabled,
@@ -90,9 +90,9 @@ export declare const bestPracticeRules: {
90
90
  */
91
91
  "block-scoped-var": "error";
92
92
  /**
93
- * Require curly braces for multiline blocks.
93
+ * Require curly braces around control statement bodies.
94
94
  */
95
- curly: ["error", "multi-line"];
95
+ curly: ["error", "all"];
96
96
  /**
97
97
  * Require default clauses in switch statements to be last (if used).
98
98
  */
@@ -90,9 +90,9 @@ const bestPracticeRules = {
90
90
  */
91
91
  "block-scoped-var": "error",
92
92
  /**
93
- * Require curly braces for multiline blocks.
93
+ * Require curly braces around control statement bodies.
94
94
  */
95
- curly: ["error", "multi-line"],
95
+ curly: ["error", "all"],
96
96
  /**
97
97
  * Require default clauses in switch statements to be last (if used).
98
98
  */
@@ -1,8 +1,8 @@
1
1
  import "node:path";
2
2
  import "node:url";
3
3
  import.meta.url;
4
- import { createOxfmtConfig } from "../oxfmt/index.js";
5
4
  import { createOxlintConfig } from "../oxlint/index.js";
5
+ import { createOxfmtConfig } from "../oxfmt/index.js";
6
6
  // src/vite-plus/index.ts
7
7
  const createVitePlusConfig = (options) => ({
8
8
  ...options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haltcase/style",
3
- "version": "9.0.0-canary.2",
3
+ "version": "9.0.0-canary.4",
4
4
  "description": "haltcase's web ecosystem style guide & configurations",
5
5
  "keywords": [
6
6
  "editorconfig",
@@ -92,7 +92,7 @@
92
92
  "@commitlint/cli": "21.2.3",
93
93
  "@commitlint/config-conventional": "21.2.3",
94
94
  "@commitlint/types": "21.2.3",
95
- "@haltcase/style": "9.0.0-canary.2",
95
+ "@haltcase/style": "9.0.0-canary.4",
96
96
  "@octokit/types": "16.0.0",
97
97
  "@octokit/webhooks-types": "7.6.1",
98
98
  "@semantic-release/git": "11.0.1",