@sinemacula/coding-standards 1.9.0 → 1.9.1
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 +1 -1
- package/js/biome.json +15 -1
- package/js/eslint/rules/no-base-error.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,7 +247,7 @@ type-checked layer.
|
|
|
247
247
|
| `@sinemacula/boolean-method-name` | Boolean-returning methods need an is/has/can prefix; `@imperative` exempt. |
|
|
248
248
|
| `@sinemacula/no-mutable-static` | No mutable exported bindings or mutable `static` class fields; test code exempt. |
|
|
249
249
|
| `@sinemacula/max-methods-per-class` | A single class may declare at most 20 methods; test code exempt. |
|
|
250
|
-
| `@sinemacula/no-base-error` | Throw a domain-specific `Error` subclass, never the base `Error
|
|
250
|
+
| `@sinemacula/no-base-error` | Throw a domain-specific `Error` subclass, never the base `Error`; test code exempt. |
|
|
251
251
|
| `@sinemacula/require-copyright` | Every file must carry a documentation comment with `@copyright` and `@author`. |
|
|
252
252
|
|
|
253
253
|
`boolean-method-name` takes `additionalPrefixes`, `additionalPredicates` and `additionalCommandVerbs` (string arrays)
|
package/js/biome.json
CHANGED
|
@@ -60,7 +60,21 @@
|
|
|
60
60
|
"useConst": "warn",
|
|
61
61
|
"useDefaultParameterLast": "warn",
|
|
62
62
|
"useExponentiationOperator": "warn",
|
|
63
|
-
"useNamingConvention":
|
|
63
|
+
"useNamingConvention": {
|
|
64
|
+
"level": "warn",
|
|
65
|
+
"options": {
|
|
66
|
+
"conventions": [
|
|
67
|
+
{
|
|
68
|
+
"selector": { "kind": "objectLiteralProperty" },
|
|
69
|
+
"formats": ["camelCase", "snake_case", "PascalCase"]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"selector": { "kind": "typeProperty" },
|
|
73
|
+
"formats": ["camelCase", "snake_case", "PascalCase"]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
64
78
|
"useShorthandAssign": "warn",
|
|
65
79
|
"useSingleVarDeclarator": "warn",
|
|
66
80
|
"useTemplate": "warn",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRule } from './lib.js';
|
|
1
|
+
import { createRule, isTestPath } from './lib.js';
|
|
2
2
|
|
|
3
3
|
/** Global objects whose `Error` member resolves to the base `Error`. */
|
|
4
4
|
const GLOBAL_OBJECTS = new Set(['globalThis', 'window', 'global', 'self']);
|
|
@@ -64,6 +64,9 @@ function isBaseError(callee) {
|
|
|
64
64
|
* ever a candidate, so listing `Error` in the `allow` option is the one way to
|
|
65
65
|
* permit it; any other name has nothing to match and stays inert.
|
|
66
66
|
*
|
|
67
|
+
* Test files are exempt: stubs and fakes legitimately throw the base `Error`
|
|
68
|
+
* (`throw new Error('not implemented')`), where a domain subclass adds nothing.
|
|
69
|
+
*
|
|
67
70
|
* @author Ben Carey <bdmc@sinemacula.co.uk>
|
|
68
71
|
* @copyright 2026 Sine Macula Limited
|
|
69
72
|
*/
|
|
@@ -92,6 +95,10 @@ export default createRule({
|
|
|
92
95
|
},
|
|
93
96
|
defaultOptions: [{ allow: [] }],
|
|
94
97
|
create(context, [options]) {
|
|
98
|
+
if (isTestPath(context.filename)) {
|
|
99
|
+
return {};
|
|
100
|
+
}
|
|
101
|
+
|
|
95
102
|
const allow = options.allow ?? [];
|
|
96
103
|
|
|
97
104
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sinemacula/coding-standards",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Centralized coding standards, static analysis configurations, and code quality tooling for all Sine Macula repositories.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Ben Carey <bdmc@sinemacula.co.uk>",
|