@sister.software/oxlint-config 9.0.0 → 9.1.0
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/out/headers-plugin.d.ts +2 -38
- package/out/headers-plugin.d.ts.map +1 -1
- package/out/headers-plugin.js +2 -2
- package/out/headers-plugin.js.map +1 -1
- package/out/index.d.ts +3 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +7 -2
- package/out/index.js.map +1 -1
- package/out/padding-plugin.d.ts +13 -0
- package/out/padding-plugin.d.ts.map +1 -0
- package/out/padding-plugin.js +70 -0
- package/out/padding-plugin.js.map +1 -0
- package/out/plugin-types.d.ts +54 -0
- package/out/plugin-types.d.ts.map +1 -0
- package/out/plugin-types.js +9 -0
- package/out/plugin-types.js.map +1 -0
- package/out/plugin.d.ts +11 -0
- package/out/plugin.d.ts.map +1 -0
- package/out/plugin.js +18 -0
- package/out/plugin.js.map +1 -0
- package/out/restrictions.d.ts +2 -0
- package/out/restrictions.d.ts.map +1 -1
- package/out/restrictions.js +2 -0
- package/out/restrictions.js.map +1 -1
- package/package.json +5 -1
- package/src/headers-plugin.ts +4 -39
- package/src/index.ts +10 -1
- package/src/padding-plugin.ts +81 -0
- package/src/plugin-types.ts +49 -0
- package/src/plugin.ts +21 -0
- package/src/restrictions.ts +2 -0
package/out/headers-plugin.d.ts
CHANGED
|
@@ -6,50 +6,14 @@
|
|
|
6
6
|
* API). It reports files missing the `@copyright`/`@license`/`@author` header and autofixes them
|
|
7
7
|
* while preserving any other JSDoc tags already present in the leading comment block.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
type: string;
|
|
11
|
-
value: string;
|
|
12
|
-
range: [number, number];
|
|
13
|
-
}
|
|
14
|
-
interface SourceCode {
|
|
15
|
-
getText(): string;
|
|
16
|
-
getAllComments(): Comment[];
|
|
17
|
-
}
|
|
18
|
-
interface Fixer {
|
|
19
|
-
insertTextBeforeRange(range: [number, number], text: string): unknown;
|
|
20
|
-
replaceTextRange(range: [number, number], text: string): unknown;
|
|
21
|
-
}
|
|
22
|
-
interface RuleContext {
|
|
23
|
-
options: unknown[];
|
|
24
|
-
sourceCode?: SourceCode;
|
|
25
|
-
getSourceCode?(): SourceCode;
|
|
26
|
-
report(descriptor: {
|
|
27
|
-
node: unknown;
|
|
28
|
-
message: string;
|
|
29
|
-
fix?(fixer: Fixer): unknown;
|
|
30
|
-
}): void;
|
|
31
|
-
}
|
|
32
|
-
interface Rule {
|
|
33
|
-
meta: {
|
|
34
|
-
name: string;
|
|
35
|
-
type: string;
|
|
36
|
-
fixable: "code";
|
|
37
|
-
schema: unknown[];
|
|
38
|
-
};
|
|
39
|
-
create(context: RuleContext): Record<string, (node: unknown) => void>;
|
|
40
|
-
}
|
|
41
|
-
interface Plugin {
|
|
42
|
-
meta: {
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
rules: Record<string, Rule>;
|
|
46
|
-
}
|
|
9
|
+
import type { Plugin, Rule } from "./plugin-types.js";
|
|
47
10
|
/** Options accepted by the header rule. */
|
|
48
11
|
export interface HeaderRuleOptions {
|
|
49
12
|
copyrightHolder?: string;
|
|
50
13
|
spdxLicenseIdentifier?: string;
|
|
51
14
|
author?: string;
|
|
52
15
|
}
|
|
16
|
+
export declare const headerRule: Rule;
|
|
53
17
|
/** The Sister Software oxlint header plugin. Registers the `sister-software/require-file-header` rule. */
|
|
54
18
|
declare const headerPlugin: Plugin;
|
|
55
19
|
export default headerPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers-plugin.d.ts","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"headers-plugin.d.ts","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,MAAM,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE9D,2CAA2C;AAC3C,MAAM,WAAW,iBAAiB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAeD,eAAO,MAAM,UAAU,EAAE,IAiExB,CAAA;AAED,0GAA0G;AAC1G,QAAA,MAAM,YAAY,EAAE,MAGnB,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/out/headers-plugin.js
CHANGED
|
@@ -17,7 +17,7 @@ function parseInnerLines(comment) {
|
|
|
17
17
|
.map((line) => line.replace(/^\s*\*?\s?/, "").replace(/\s+$/, ""))
|
|
18
18
|
.filter((line) => line.length > 0);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
export const headerRule = {
|
|
21
21
|
meta: {
|
|
22
22
|
name: "require-file-header",
|
|
23
23
|
type: "layout",
|
|
@@ -79,7 +79,7 @@ const rule = {
|
|
|
79
79
|
/** The Sister Software oxlint header plugin. Registers the `sister-software/require-file-header` rule. */
|
|
80
80
|
const headerPlugin = {
|
|
81
81
|
meta: { name: "sister-software" },
|
|
82
|
-
rules: { "require-file-header":
|
|
82
|
+
rules: { "require-file-header": headerRule },
|
|
83
83
|
};
|
|
84
84
|
export default headerPlugin;
|
|
85
85
|
//# sourceMappingURL=headers-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers-plugin.js","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"headers-plugin.js","sourceRoot":"","sources":["../src/headers-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,MAAM,kBAAkB,GAAG,gCAAgC,CAAA;AAE3D;;;GAGG;AACH,SAAS,eAAe,CAAC,OAAgB;IACxC,OAAO,OAAO,CAAC,KAAK;SAClB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE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BAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;wBACpD,CAAC;qBACD,CAAC,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACP,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;oBAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAA;oBAE/B,OAAO,CAAC,MAAM,CAAC;wBACd,IAAI;wBACJ,OAAO,EAAE,oDAAoD;wBAC7D,GAAG,CAAC,KAAK;4BACR,OAAO,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,CAAA;wBACzE,CAAC;qBACD,CAAC,CAAA;gBACH,CAAC;YACF,CAAC;SACD,CAAA;IACF,CAAC;CACD,CAAA;AAED,0GAA0G;AAC1G,MAAM,YAAY,GAAW;IAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACjC,KAAK,EAAE,EAAE,qBAAqB,EAAE,UAAU,EAAE;CAC5C,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/out/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface OxlintConfigOptions {
|
|
|
21
21
|
react?: boolean;
|
|
22
22
|
/** Enforce file headers via the bundled JS plugin (on by default). */
|
|
23
23
|
headers?: boolean;
|
|
24
|
+
/** Require a blank line before `return`/block-like statements (on by default). */
|
|
25
|
+
padding?: boolean;
|
|
24
26
|
/** Override the default ignore patterns. */
|
|
25
27
|
ignorePatterns?: string[];
|
|
26
28
|
/** Extra config deep-merged last; an escape hatch for per-repo tweaks. */
|
|
@@ -39,6 +41,7 @@ export declare const DefaultIgnorePatterns: string[];
|
|
|
39
41
|
* ```
|
|
40
42
|
*
|
|
41
43
|
* @param options Configuration options.
|
|
44
|
+
*
|
|
42
45
|
* @returns A complete oxlint config object (no `extends` required).
|
|
43
46
|
*/
|
|
44
47
|
export declare function createOxlintConfig(options?: OxlintConfigOptions): OxlintConfig;
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,cAAc,mBAAmB,CAAA;AAEjC,4FAA4F;AAC5F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAElD,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,6DAA6D;IAC7D,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,YAAY,CAAA;CACxB;AAED,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,UAOjC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,cAAc,mBAAmB,CAAA;AAEjC,4FAA4F;AAC5F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAElD,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,6DAA6D;IAC7D,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,YAAY,CAAA;CACxB;AAED,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,UAOjC,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAoElF;AAED,eAAe,kBAAkB,CAAA"}
|
package/out/index.js
CHANGED
|
@@ -26,10 +26,11 @@ export const DefaultIgnorePatterns = [
|
|
|
26
26
|
* ```
|
|
27
27
|
*
|
|
28
28
|
* @param options Configuration options.
|
|
29
|
+
*
|
|
29
30
|
* @returns A complete oxlint config object (no `extends` required).
|
|
30
31
|
*/
|
|
31
32
|
export function createOxlintConfig(options = {}) {
|
|
32
|
-
const { packageNamespace = "@sister.software", copyrightHolder = "Sister Software", spdxLicenseIdentifier = "UNLICENSED", author = "Teffen Ellis, et al.", react = false, headers = true, ignorePatterns = DefaultIgnorePatterns, overrides = {}, } = options;
|
|
33
|
+
const { packageNamespace = "@sister.software", copyrightHolder = "Sister Software", spdxLicenseIdentifier = "UNLICENSED", author = "Teffen Ellis, et al.", react = false, headers = true, padding = true, ignorePatterns = DefaultIgnorePatterns, overrides = {}, } = options;
|
|
33
34
|
const plugins = ["typescript", "unicorn", "oxc", ...(react ? ["react"] : [])];
|
|
34
35
|
const rules = {
|
|
35
36
|
// JavaScript
|
|
@@ -67,9 +68,13 @@ export function createOxlintConfig(options = {}) {
|
|
|
67
68
|
// editor error. The rule is auto-fixable, so `oxlint --fix` keeps the friction low.
|
|
68
69
|
rules["sister-software/require-file-header"] = ["error", { copyrightHolder, spdxLicenseIdentifier, author }];
|
|
69
70
|
}
|
|
71
|
+
if (padding) {
|
|
72
|
+
// Warning severity: a stylistic nudge (auto-fixable), not a hard CI gate.
|
|
73
|
+
rules["sister-software/padding-lines"] = "warn";
|
|
74
|
+
}
|
|
70
75
|
return {
|
|
71
76
|
plugins,
|
|
72
|
-
...(headers ? { jsPlugins: ["@sister.software/oxlint-config/
|
|
77
|
+
...(headers || padding ? { jsPlugins: ["@sister.software/oxlint-config/plugin"] } : {}),
|
|
73
78
|
categories: { correctness: "error" },
|
|
74
79
|
ignorePatterns,
|
|
75
80
|
rules,
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,cAAc,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,cAAc,mBAAmB,CAAA;AA2BjC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,QAAQ;IACR,SAAS;IACT,mBAAmB;IACnB,iBAAiB;IACjB,aAAa;IACb,qBAAqB;CACrB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAA+B,EAAE;IACnE,MAAM,EACL,gBAAgB,GAAG,kBAAkB,EACrC,eAAe,GAAG,iBAAiB,EACnC,qBAAqB,GAAG,YAAY,EACpC,MAAM,GAAG,sBAAsB,EAC/B,KAAK,GAAG,KAAK,EACb,OAAO,GAAG,IAAI,EACd,OAAO,GAAG,IAAI,EACd,cAAc,GAAG,qBAAqB,EACtC,SAAS,GAAG,EAAE,GACd,GAAG,OAAO,CAAA;IAEX,MAAM,OAAO,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D,CAAC;IAED,OAAO;QACN,OAAO;QACP,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,uCAAuC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,UAAU,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE;QACpC,cAAc;QACd,KAAK;QACL,SAAS,EAAE,sBAAsB,CAAC,gBAAgB,CAAC;QACnD,GAAG,SAAS;KACZ,CAAA;AACF,CAAC;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file A padding-lines rule, authored as an oxlint JS plugin (ESLint v9-compatible API). It
|
|
6
|
+
* requires a blank line before `return` and block-like statements (the equivalent of ESLint's
|
|
7
|
+
* `padding-line-between-statements` with `{ blankLine: "always", prev: "*", next: "return" | "block-like" }`),
|
|
8
|
+
* and autofixes by inserting the missing blank line (before any leading comments).
|
|
9
|
+
*/
|
|
10
|
+
import type { Rule } from "./plugin-types.js";
|
|
11
|
+
export declare const paddingRule: Rule;
|
|
12
|
+
export default paddingRule;
|
|
13
|
+
//# sourceMappingURL=padding-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"padding-plugin.d.ts","sourceRoot":"","sources":["../src/padding-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAmBtD,eAAO,MAAM,WAAW,EAAE,IAiDzB,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file A padding-lines rule, authored as an oxlint JS plugin (ESLint v9-compatible API). It
|
|
6
|
+
* requires a blank line before `return` and block-like statements (the equivalent of ESLint's
|
|
7
|
+
* `padding-line-between-statements` with `{ blankLine: "always", prev: "*", next: "return" | "block-like" }`),
|
|
8
|
+
* and autofixes by inserting the missing blank line (before any leading comments).
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Statement node types that require a preceding blank line: `return` plus all "block-like" statements (matching
|
|
12
|
+
* ESLint's `block-like` selector).
|
|
13
|
+
*/
|
|
14
|
+
const PADDED_STATEMENT_TYPES = [
|
|
15
|
+
"ReturnStatement",
|
|
16
|
+
"BlockStatement",
|
|
17
|
+
"IfStatement",
|
|
18
|
+
"ForStatement",
|
|
19
|
+
"ForInStatement",
|
|
20
|
+
"ForOfStatement",
|
|
21
|
+
"WhileStatement",
|
|
22
|
+
"DoWhileStatement",
|
|
23
|
+
"SwitchStatement",
|
|
24
|
+
"TryStatement",
|
|
25
|
+
];
|
|
26
|
+
export const paddingRule = {
|
|
27
|
+
meta: {
|
|
28
|
+
name: "padding-lines",
|
|
29
|
+
type: "layout",
|
|
30
|
+
fixable: "whitespace",
|
|
31
|
+
schema: [{ type: "object", additionalProperties: true }],
|
|
32
|
+
},
|
|
33
|
+
create(context) {
|
|
34
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
35
|
+
const text = sourceCode.getText();
|
|
36
|
+
const comments = sourceCode.getAllComments();
|
|
37
|
+
function check(node) {
|
|
38
|
+
const parent = node.parent;
|
|
39
|
+
// Only statements that are direct members of a statement list (a block/program body).
|
|
40
|
+
// This naturally skips e.g. an `if` consequent block or switch-case bodies.
|
|
41
|
+
if (!parent || !Array.isArray(parent.body))
|
|
42
|
+
return;
|
|
43
|
+
const index = parent.body.indexOf(node);
|
|
44
|
+
if (index <= 0)
|
|
45
|
+
return; // first statement in the block — nothing to pad against.
|
|
46
|
+
const previous = parent.body[index - 1];
|
|
47
|
+
// A blank line should sit before the statement's own leading comments, so measure the gap
|
|
48
|
+
// up to the earliest comment between the previous statement and this one.
|
|
49
|
+
let start = node.range[0];
|
|
50
|
+
for (const comment of comments) {
|
|
51
|
+
if (comment.range[0] >= previous.range[1] && comment.range[1] <= node.range[0]) {
|
|
52
|
+
start = Math.min(start, comment.range[0]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const gap = text.slice(previous.range[1], start);
|
|
56
|
+
if ((gap.match(/\n/g) ?? []).length >= 2)
|
|
57
|
+
return; // already a blank line.
|
|
58
|
+
context.report({
|
|
59
|
+
node,
|
|
60
|
+
message: "Expected a blank line before this statement.",
|
|
61
|
+
fix(fixer) {
|
|
62
|
+
return fixer.insertTextAfterRange([previous.range[1], previous.range[1]], "\n");
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return Object.fromEntries(PADDED_STATEMENT_TYPES.map((type) => [type, check]));
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export default paddingRule;
|
|
70
|
+
//# sourceMappingURL=padding-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"padding-plugin.js","sourceRoot":"","sources":["../src/padding-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,MAAM,sBAAsB,GAAG;IAC9B,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;CACL,CAAA;AAEV,MAAM,CAAC,MAAM,WAAW,GAAS;IAChC,IAAI,EAAE;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;KACxD;IACD,MAAM,CAAC,OAAO;QACb,MAAM,UAAU,GAAG,OAA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,CAAC,MAAM,IAAI,CAAC;gBAAE,OAAM,CAAC,wBAAwB;YAEzE,OAAO,CAAC,MAAM,CAAC;gBACd,IAAI;gBACJ,OAAO,EAAE,8CAA8C;gBACvD,GAAG,CAAC,KAAK;oBACR,OAAO,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;gBAChF,CAAC;aACD,CAAC,CAAA;QACH,CAAC;QAED,OAAO,MAAM,CAAC,WAAW,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IAC/E,CAAC;CACD,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file Minimal ESLint-compatible plugin types shared by the bundled oxlint JS plugins. Kept local
|
|
6
|
+
* to avoid coupling to oxlint's alpha internal type surface, which is not subject to semver.
|
|
7
|
+
*/
|
|
8
|
+
export interface Comment {
|
|
9
|
+
type: string;
|
|
10
|
+
value: string;
|
|
11
|
+
range: [number, number];
|
|
12
|
+
}
|
|
13
|
+
/** A loosely-typed AST node — only the fields the bundled rules read. */
|
|
14
|
+
export interface AstNode {
|
|
15
|
+
type: string;
|
|
16
|
+
range: [number, number];
|
|
17
|
+
parent?: AstNode;
|
|
18
|
+
body?: AstNode[];
|
|
19
|
+
}
|
|
20
|
+
export interface SourceCode {
|
|
21
|
+
getText(): string;
|
|
22
|
+
getAllComments(): Comment[];
|
|
23
|
+
}
|
|
24
|
+
export interface Fixer {
|
|
25
|
+
insertTextBeforeRange(range: [number, number], text: string): unknown;
|
|
26
|
+
insertTextAfterRange(range: [number, number], text: string): unknown;
|
|
27
|
+
replaceTextRange(range: [number, number], text: string): unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface RuleContext {
|
|
30
|
+
options: unknown[];
|
|
31
|
+
sourceCode?: SourceCode;
|
|
32
|
+
getSourceCode?(): SourceCode;
|
|
33
|
+
report(descriptor: {
|
|
34
|
+
node: unknown;
|
|
35
|
+
message: string;
|
|
36
|
+
fix?(fixer: Fixer): unknown;
|
|
37
|
+
}): void;
|
|
38
|
+
}
|
|
39
|
+
export interface Rule {
|
|
40
|
+
meta: {
|
|
41
|
+
name: string;
|
|
42
|
+
type: string;
|
|
43
|
+
fixable?: "code" | "whitespace";
|
|
44
|
+
schema: unknown[];
|
|
45
|
+
};
|
|
46
|
+
create(context: RuleContext): Record<string, (node: AstNode) => void>;
|
|
47
|
+
}
|
|
48
|
+
export interface Plugin {
|
|
49
|
+
meta: {
|
|
50
|
+
name: string;
|
|
51
|
+
};
|
|
52
|
+
rules: Record<string, Rule>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=plugin-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-types.d.ts","sourceRoot":"","sources":["../src/plugin-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvB;AAED,yEAAyE;AACzE,MAAM,WAAW,OAAO;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IAC1B,OAAO,IAAI,MAAM,CAAA;IACjB,cAAc,IAAI,OAAO,EAAE,CAAA;C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4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file Minimal ESLint-compatible plugin types shared by the bundled oxlint JS plugins. Kept local
|
|
6
|
+
* to avoid coupling to oxlint's alpha internal type surface, which is not subject to semver.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=plugin-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-types.js","sourceRoot":"","sources":["../src/plugin-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/out/plugin.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The bundled Sister Software oxlint JS plugin. A single plugin (oxlint requires unique plugin
|
|
6
|
+
* names) exposing all of Sister Software's custom rules under the `sister-software/` namespace.
|
|
7
|
+
*/
|
|
8
|
+
import type { Plugin } from "./plugin-types.js";
|
|
9
|
+
declare const sisterSoftwarePlugin: Plugin;
|
|
10
|
+
export default sisterSoftwarePlugin;
|
|
11
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,QAAA,MAAM,oBAAoB,EAAE,MAM3B,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
package/out/plugin.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The bundled Sister Software oxlint JS plugin. A single plugin (oxlint requires unique plugin
|
|
6
|
+
* names) exposing all of Sister Software's custom rules under the `sister-software/` namespace.
|
|
7
|
+
*/
|
|
8
|
+
import { headerRule } from "./headers-plugin.js";
|
|
9
|
+
import { paddingRule } from "./padding-plugin.js";
|
|
10
|
+
const sisterSoftwarePlugin = {
|
|
11
|
+
meta: { name: "sister-software" },
|
|
12
|
+
rules: {
|
|
13
|
+
"require-file-header": headerRule,
|
|
14
|
+
"padding-lines": paddingRule,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default sisterSoftwarePlugin;
|
|
18
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAGjD,MAAM,oBAAoB,GAAW;IACpC,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACjC,KAAK,EAAE;QACN,qBAAqB,EAAE,UAAU;QACjC,eAAe,EAAE,WAAW;KAC5B;CACD,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
package/out/restrictions.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type RuntimeName = keyof RuntimePackageNamesRecord;
|
|
|
23
23
|
* Given a package name, produces the glob matcher for files belonging to that package.
|
|
24
24
|
*
|
|
25
25
|
* @param packageName The final package-name segment, e.g. `client`.
|
|
26
|
+
*
|
|
26
27
|
* @returns A single-element glob array, e.g. `["**\/client.{js,...}"]`.
|
|
27
28
|
*/
|
|
28
29
|
export declare function createPackageFileMatcher(packageName: string): string[];
|
|
@@ -52,6 +53,7 @@ export interface OxlintOverride {
|
|
|
52
53
|
* have no override of their own).
|
|
53
54
|
*
|
|
54
55
|
* @param packageNamespace The namespace whose packages are subject to the rules, e.g. `@sister.software`.
|
|
56
|
+
*
|
|
55
57
|
* @returns An array of oxlint `overrides` entries.
|
|
56
58
|
*/
|
|
57
59
|
export declare function createRuntimeOverrides(packageNamespace: string): OxlintOverride[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restrictions.d.ts","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;;CAK5B,CAAA;AAEV,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,MAAM,yBAAyB,CAAA;AAEzD
|
|
1
|
+
{"version":3,"file":"restrictions.d.ts","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;;CAK5B,CAAA;AAEV,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG,MAAM,yBAAyB,CAAA;AAEzD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAEtE;AAiBD,kGAAkG;AAClG,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,cAAc,EAAE,CAK5D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAErE;AA+ED,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,GAAG,cAAc,EAAE,CAqDjF"}
|
package/out/restrictions.js
CHANGED
|
@@ -22,6 +22,7 @@ export const RuntimePackageNamesRecord = {
|
|
|
22
22
|
* Given a package name, produces the glob matcher for files belonging to that package.
|
|
23
23
|
*
|
|
24
24
|
* @param packageName The final package-name segment, e.g. `client`.
|
|
25
|
+
*
|
|
25
26
|
* @returns A single-element glob array, e.g. `["**\/client.{js,...}"]`.
|
|
26
27
|
*/
|
|
27
28
|
export function createPackageFileMatcher(packageName) {
|
|
@@ -140,6 +141,7 @@ function crossRuntimePatterns(packageNamespace, self, incompatible) {
|
|
|
140
141
|
* have no override of their own).
|
|
141
142
|
*
|
|
142
143
|
* @param packageNamespace The namespace whose packages are subject to the rules, e.g. `@sister.software`.
|
|
144
|
+
*
|
|
143
145
|
* @returns An array of oxlint `overrides` entries.
|
|
144
146
|
*/
|
|
145
147
|
export function createRuntimeOverrides(packageNamespace) {
|
package/out/restrictions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restrictions.js","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,sBAAsB;AAEtB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC9B,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC;IAC/B,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC9B,MAAM,EAAE,CAAC,QAAQ,CAAC;CACT,CAAA;AAOV
|
|
1
|
+
{"version":3,"file":"restrictions.js","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,sBAAsB;AAEtB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG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AC;YACd,KAAK,EAAE,wBAAwB,CAAC,WAAW,CAAC;YAC5C,KAAK,EAAE;gBACN,uBAAuB,EAAE;oBACxB,MAAM;oBACN;wBACC,KAAK,EAAE,mBAAmB,CACzB,mFAAmF,CACnF;wBACD,QAAQ,EAAE,oBAAoB,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;qBAC3F;iBACD;aACD;SACD,CAAC,CAAA;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AACjB,CAAC;AAED,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sister.software/oxlint-config",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Sister Software's oxlint config",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"author": "teffen@sister.software",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"./headers-plugin": {
|
|
22
22
|
"import": "./out/headers-plugin.js",
|
|
23
23
|
"types": "./out/headers-plugin.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./plugin": {
|
|
26
|
+
"import": "./out/plugin.js",
|
|
27
|
+
"types": "./out/plugin.d.ts"
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
"publishConfig": {
|
package/src/headers-plugin.ts
CHANGED
|
@@ -7,43 +7,7 @@
|
|
|
7
7
|
* while preserving any other JSDoc tags already present in the leading comment block.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
// internal type surface, which is not subject to semver).
|
|
12
|
-
|
|
13
|
-
interface Comment {
|
|
14
|
-
type: string
|
|
15
|
-
value: string
|
|
16
|
-
range: [number, number]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface SourceCode {
|
|
20
|
-
getText(): string
|
|
21
|
-
getAllComments(): Comment[]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface Fixer {
|
|
25
|
-
insertTextBeforeRange(range: [number, number], text: string): unknown
|
|
26
|
-
replaceTextRange(range: [number, number], text: string): unknown
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface RuleContext {
|
|
30
|
-
options: unknown[]
|
|
31
|
-
sourceCode?: SourceCode
|
|
32
|
-
getSourceCode?(): SourceCode
|
|
33
|
-
report(descriptor: { node: unknown; message: string; fix?(fixer: Fixer): unknown }): void
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface Rule {
|
|
37
|
-
meta: { name: string; type: string; fixable: "code"; schema: unknown[] }
|
|
38
|
-
create(context: RuleContext): Record<string, (node: unknown) => void>
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface Plugin {
|
|
42
|
-
meta: { name: string }
|
|
43
|
-
rules: Record<string, Rule>
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
10
|
+
import type { Comment, Plugin, Rule } from "./plugin-types.js"
|
|
47
11
|
|
|
48
12
|
/** Options accepted by the header rule. */
|
|
49
13
|
export interface HeaderRuleOptions {
|
|
@@ -65,7 +29,7 @@ function parseInnerLines(comment: Comment): string[] {
|
|
|
65
29
|
.filter((line) => line.length > 0)
|
|
66
30
|
}
|
|
67
31
|
|
|
68
|
-
const
|
|
32
|
+
export const headerRule: Rule = {
|
|
69
33
|
meta: {
|
|
70
34
|
name: "require-file-header",
|
|
71
35
|
type: "layout",
|
|
@@ -102,6 +66,7 @@ const rule: Rule = {
|
|
|
102
66
|
if (leading) {
|
|
103
67
|
const existing = parseInnerLines(leading)
|
|
104
68
|
const missing = headerLines.filter((line) => !existing.includes(line))
|
|
69
|
+
|
|
105
70
|
if (missing.length === 0) return
|
|
106
71
|
|
|
107
72
|
const preserved = existing.filter((line) => !HEADER_TAG_PATTERN.test(line))
|
|
@@ -134,7 +99,7 @@ const rule: Rule = {
|
|
|
134
99
|
/** The Sister Software oxlint header plugin. Registers the `sister-software/require-file-header` rule. */
|
|
135
100
|
const headerPlugin: Plugin = {
|
|
136
101
|
meta: { name: "sister-software" },
|
|
137
|
-
rules: { "require-file-header":
|
|
102
|
+
rules: { "require-file-header": headerRule },
|
|
138
103
|
}
|
|
139
104
|
|
|
140
105
|
export default headerPlugin
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface OxlintConfigOptions {
|
|
|
26
26
|
react?: boolean
|
|
27
27
|
/** Enforce file headers via the bundled JS plugin (on by default). */
|
|
28
28
|
headers?: boolean
|
|
29
|
+
/** Require a blank line before `return`/block-like statements (on by default). */
|
|
30
|
+
padding?: boolean
|
|
29
31
|
/** Override the default ignore patterns. */
|
|
30
32
|
ignorePatterns?: string[]
|
|
31
33
|
/** Extra config deep-merged last; an escape hatch for per-repo tweaks. */
|
|
@@ -53,6 +55,7 @@ export const DefaultIgnorePatterns = [
|
|
|
53
55
|
* ```
|
|
54
56
|
*
|
|
55
57
|
* @param options Configuration options.
|
|
58
|
+
*
|
|
56
59
|
* @returns A complete oxlint config object (no `extends` required).
|
|
57
60
|
*/
|
|
58
61
|
export function createOxlintConfig(options: OxlintConfigOptions = {}): OxlintConfig {
|
|
@@ -63,6 +66,7 @@ export function createOxlintConfig(options: OxlintConfigOptions = {}): OxlintCon
|
|
|
63
66
|
author = "Teffen Ellis, et al.",
|
|
64
67
|
react = false,
|
|
65
68
|
headers = true,
|
|
69
|
+
padding = true,
|
|
66
70
|
ignorePatterns = DefaultIgnorePatterns,
|
|
67
71
|
overrides = {},
|
|
68
72
|
} = options
|
|
@@ -108,9 +112,14 @@ export function createOxlintConfig(options: OxlintConfigOptions = {}): OxlintCon
|
|
|
108
112
|
rules["sister-software/require-file-header"] = ["error", { copyrightHolder, spdxLicenseIdentifier, author }]
|
|
109
113
|
}
|
|
110
114
|
|
|
115
|
+
if (padding) {
|
|
116
|
+
// Warning severity: a stylistic nudge (auto-fixable), not a hard CI gate.
|
|
117
|
+
rules["sister-software/padding-lines"] = "warn"
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
return {
|
|
112
121
|
plugins,
|
|
113
|
-
...(headers ? { jsPlugins: ["@sister.software/oxlint-config/
|
|
122
|
+
...(headers || padding ? { jsPlugins: ["@sister.software/oxlint-config/plugin"] } : {}),
|
|
114
123
|
categories: { correctness: "error" },
|
|
115
124
|
ignorePatterns,
|
|
116
125
|
rules,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file A padding-lines rule, authored as an oxlint JS plugin (ESLint v9-compatible API). It
|
|
6
|
+
* requires a blank line before `return` and block-like statements (the equivalent of ESLint's
|
|
7
|
+
* `padding-line-between-statements` with `{ blankLine: "always", prev: "*", next: "return" | "block-like" }`),
|
|
8
|
+
* and autofixes by inserting the missing blank line (before any leading comments).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { AstNode, Rule } from "./plugin-types.js"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Statement node types that require a preceding blank line: `return` plus all "block-like" statements (matching
|
|
15
|
+
* ESLint's `block-like` selector).
|
|
16
|
+
*/
|
|
17
|
+
const PADDED_STATEMENT_TYPES = [
|
|
18
|
+
"ReturnStatement",
|
|
19
|
+
"BlockStatement",
|
|
20
|
+
"IfStatement",
|
|
21
|
+
"ForStatement",
|
|
22
|
+
"ForInStatement",
|
|
23
|
+
"ForOfStatement",
|
|
24
|
+
"WhileStatement",
|
|
25
|
+
"DoWhileStatement",
|
|
26
|
+
"SwitchStatement",
|
|
27
|
+
"TryStatement",
|
|
28
|
+
] as const
|
|
29
|
+
|
|
30
|
+
export const paddingRule: Rule = {
|
|
31
|
+
meta: {
|
|
32
|
+
name: "padding-lines",
|
|
33
|
+
type: "layout",
|
|
34
|
+
fixable: "whitespace",
|
|
35
|
+
schema: [{ type: "object", additionalProperties: true }],
|
|
36
|
+
},
|
|
37
|
+
create(context) {
|
|
38
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode!()
|
|
39
|
+
const text = sourceCode.getText()
|
|
40
|
+
const comments = sourceCode.getAllComments()
|
|
41
|
+
|
|
42
|
+
function check(node: AstNode) {
|
|
43
|
+
const parent = node.parent
|
|
44
|
+
|
|
45
|
+
// Only statements that are direct members of a statement list (a block/program body).
|
|
46
|
+
// This naturally skips e.g. an `if` consequent block or switch-case bodies.
|
|
47
|
+
if (!parent || !Array.isArray(parent.body)) return
|
|
48
|
+
|
|
49
|
+
const index = parent.body.indexOf(node)
|
|
50
|
+
|
|
51
|
+
if (index <= 0) return // first statement in the block — nothing to pad against.
|
|
52
|
+
const previous = parent.body[index - 1]!
|
|
53
|
+
|
|
54
|
+
// A blank line should sit before the statement's own leading comments, so measure the gap
|
|
55
|
+
// up to the earliest comment between the previous statement and this one.
|
|
56
|
+
let start = node.range[0]
|
|
57
|
+
|
|
58
|
+
for (const comment of comments) {
|
|
59
|
+
if (comment.range[0] >= previous.range[1] && comment.range[1] <= node.range[0]) {
|
|
60
|
+
start = Math.min(start, comment.range[0])
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const gap = text.slice(previous.range[1], start)
|
|
65
|
+
|
|
66
|
+
if ((gap.match(/\n/g) ?? []).length >= 2) return // already a blank line.
|
|
67
|
+
|
|
68
|
+
context.report({
|
|
69
|
+
node,
|
|
70
|
+
message: "Expected a blank line before this statement.",
|
|
71
|
+
fix(fixer) {
|
|
72
|
+
return fixer.insertTextAfterRange([previous.range[1], previous.range[1]], "\n")
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return Object.fromEntries(PADDED_STATEMENT_TYPES.map((type) => [type, check]))
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default paddingRule
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file Minimal ESLint-compatible plugin types shared by the bundled oxlint JS plugins. Kept local
|
|
6
|
+
* to avoid coupling to oxlint's alpha internal type surface, which is not subject to semver.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface Comment {
|
|
10
|
+
type: string
|
|
11
|
+
value: string
|
|
12
|
+
range: [number, number]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A loosely-typed AST node — only the fields the bundled rules read. */
|
|
16
|
+
export interface AstNode {
|
|
17
|
+
type: string
|
|
18
|
+
range: [number, number]
|
|
19
|
+
parent?: AstNode
|
|
20
|
+
body?: AstNode[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SourceCode {
|
|
24
|
+
getText(): string
|
|
25
|
+
getAllComments(): Comment[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Fixer {
|
|
29
|
+
insertTextBeforeRange(range: [number, number], text: string): unknown
|
|
30
|
+
insertTextAfterRange(range: [number, number], text: string): unknown
|
|
31
|
+
replaceTextRange(range: [number, number], text: string): unknown
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface RuleContext {
|
|
35
|
+
options: unknown[]
|
|
36
|
+
sourceCode?: SourceCode
|
|
37
|
+
getSourceCode?(): SourceCode
|
|
38
|
+
report(descriptor: { node: unknown; message: string; fix?(fixer: Fixer): unknown }): void
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface Rule {
|
|
42
|
+
meta: { name: string; type: string; fixable?: "code" | "whitespace"; schema: unknown[] }
|
|
43
|
+
create(context: RuleContext): Record<string, (node: AstNode) => void>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface Plugin {
|
|
47
|
+
meta: { name: string }
|
|
48
|
+
rules: Record<string, Rule>
|
|
49
|
+
}
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file The bundled Sister Software oxlint JS plugin. A single plugin (oxlint requires unique plugin
|
|
6
|
+
* names) exposing all of Sister Software's custom rules under the `sister-software/` namespace.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { headerRule } from "./headers-plugin.js"
|
|
10
|
+
import { paddingRule } from "./padding-plugin.js"
|
|
11
|
+
import type { Plugin } from "./plugin-types.js"
|
|
12
|
+
|
|
13
|
+
const sisterSoftwarePlugin: Plugin = {
|
|
14
|
+
meta: { name: "sister-software" },
|
|
15
|
+
rules: {
|
|
16
|
+
"require-file-header": headerRule,
|
|
17
|
+
"padding-lines": paddingRule,
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default sisterSoftwarePlugin
|
package/src/restrictions.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type RuntimeName = keyof RuntimePackageNamesRecord
|
|
|
31
31
|
* Given a package name, produces the glob matcher for files belonging to that package.
|
|
32
32
|
*
|
|
33
33
|
* @param packageName The final package-name segment, e.g. `client`.
|
|
34
|
+
*
|
|
34
35
|
* @returns A single-element glob array, e.g. `["**\/client.{js,...}"]`.
|
|
35
36
|
*/
|
|
36
37
|
export function createPackageFileMatcher(packageName: string): string[] {
|
|
@@ -193,6 +194,7 @@ function crossRuntimePatterns(
|
|
|
193
194
|
* have no override of their own).
|
|
194
195
|
*
|
|
195
196
|
* @param packageNamespace The namespace whose packages are subject to the rules, e.g. `@sister.software`.
|
|
197
|
+
*
|
|
196
198
|
* @returns An array of oxlint `overrides` entries.
|
|
197
199
|
*/
|
|
198
200
|
export function createRuntimeOverrides(packageNamespace: string): OxlintOverride[] {
|