@mslmio/eslint-config 2.0.0 → 2.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/README.md +1 -1
- package/package.json +1 -1
- package/plugin.js +1 -1
- package/rules/no-lib-process-env.js +3 -2
- package/rules/no-module-scope-init.js +1 -1
- package/rules/us-spelling.js +22 -16
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ UI half behind `/ui` means the root entry resolves neither `@shadcn/lint` nor
|
|
|
38
38
|
| `no-upward-import` | A package may not import a tier above it, or a sibling leaf. Off until configured — see below |
|
|
39
39
|
| `no-property-shorthand` | Always `{ key: key }`; exempts destructuring and imports |
|
|
40
40
|
| `no-lib-process-env` | A library never reads `process.env` — configuration is passed in |
|
|
41
|
-
| `no-module-scope-init` | No client/config built at module scope; build lazily and
|
|
41
|
+
| `no-module-scope-init` | No client/config built at module scope; build lazily and memoize |
|
|
42
42
|
| `no-express-json-spaces` | Express's `json spaces` indents but drops the trailing newline |
|
|
43
43
|
| `prefer-copy-icon` | lucide `Copy`, not `Clipboard` |
|
|
44
44
|
| `us-spelling` | US spelling in prose and identifiers |
|
package/package.json
CHANGED
package/plugin.js
CHANGED
|
@@ -9,7 +9,7 @@ import noUpwardImport from "./rules/no-upward-import.js";
|
|
|
9
9
|
import preferTableFacets from "./rules/prefer-table-facets.js";
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
-
meta: { name: "@mslmio/eslint-plugin", version: "2.
|
|
12
|
+
meta: { name: "@mslmio/eslint-plugin", version: "2.1.0" },
|
|
13
13
|
rules: {
|
|
14
14
|
"no-lib-process-env": noLibProcessEnv,
|
|
15
15
|
"no-module-scope-init": noModuleScopeInit,
|
|
@@ -28,8 +28,9 @@ export default {
|
|
|
28
28
|
create(context) {
|
|
29
29
|
const docs = docsSuffix(context);
|
|
30
30
|
const entryPoints = context.options[0]?.entryPoints ?? DEFAULT_ENTRY_POINTS;
|
|
31
|
-
const filename = context.filename ?? context.getFilename();
|
|
32
|
-
|
|
31
|
+
const filename = (context.filename ?? context.getFilename()).replaceAll("\\", "/");
|
|
32
|
+
// Whole trailing path segments, so `main.ts` exempts `src/main.ts` and never `domain.ts`.
|
|
33
|
+
if (entryPoints.some((e) => `/${filename}`.endsWith(`/${e}`))) {
|
|
33
34
|
return {};
|
|
34
35
|
}
|
|
35
36
|
return {
|
|
@@ -36,7 +36,7 @@ export default {
|
|
|
36
36
|
moduleScopeInit:
|
|
37
37
|
"`{{name}}` is constructed at module scope, so it runs on import - before any caller " +
|
|
38
38
|
"can configure it, and in every process that merely imports this file. Build it lazily " +
|
|
39
|
-
"inside a function and
|
|
39
|
+
"inside a function and memoize.{{docs}}",
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
create(context) {
|
package/rules/us-spelling.js
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
const COMPOUND_STEMS = { centre: "center", centres: "centers", centred: "centered" };
|
|
2
2
|
|
|
3
|
+
// Each -ise verb in every form: -ise, -ised, -ises, -ising and -isation(s).
|
|
4
|
+
const ISE_VERBS = {
|
|
5
|
+
apologise: "apologize", authorise: "authorize", categorise: "categorize", criticise: "criticize",
|
|
6
|
+
customise: "customize", emphasise: "emphasize", initialise: "initialize", maximise: "maximize",
|
|
7
|
+
memoise: "memoize", memorise: "memorize", minimise: "minimize", normalise: "normalize",
|
|
8
|
+
optimise: "optimize", organise: "organize", prioritise: "prioritize", realise: "realize",
|
|
9
|
+
recognise: "recognize", serialise: "serialize", specialise: "specialize",
|
|
10
|
+
standardise: "standardize", summarise: "summarize", synchronise: "synchronize",
|
|
11
|
+
utilise: "utilize", visualise: "visualize",
|
|
12
|
+
};
|
|
13
|
+
const ISE_ENDINGS = ["e", "ed", "es", "ing", "ation", "ations"];
|
|
14
|
+
|
|
3
15
|
const WORDS = {
|
|
4
16
|
metre: "meter", metres: "meters", litre: "liter", litres: "liters",
|
|
5
17
|
fibre: "fiber", fibres: "fibers", theatre: "theater", calibre: "caliber",
|
|
6
18
|
sombre: "somber", spectre: "specter", lustre: "luster", manoeuvre: "maneuver",
|
|
7
19
|
colour: "color", colours: "colors", coloured: "colored", colourful: "colorful",
|
|
8
|
-
behaviour: "behavior", behaviours: "behaviors",
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
behaviour: "behavior", behaviours: "behaviors", behavioural: "behavioral",
|
|
21
|
+
favour: "favor", favours: "favors", favoured: "favored", favouring: "favoring",
|
|
22
|
+
favourite: "favorite", favourites: "favorites", honour: "honor", honours: "honors",
|
|
23
|
+
honoured: "honored", honouring: "honoring", neighbour: "neighbor", neighbours: "neighbors",
|
|
24
|
+
neighbouring: "neighboring", labour: "labor", flavour: "flavor", flavours: "flavors",
|
|
11
25
|
harbour: "harbor", rumour: "rumor", humour: "humor", odour: "odor",
|
|
12
26
|
vapour: "vapor", armour: "armor", endeavour: "endeavor", parlour: "parlor",
|
|
13
27
|
savour: "savor", valour: "valor",
|
|
@@ -22,19 +36,11 @@ const WORDS = {
|
|
|
22
36
|
modelling: "modeling", labelled: "labeled", labelling: "labeling",
|
|
23
37
|
fuelled: "fueled", signalling: "signaling", marvellous: "marvelous",
|
|
24
38
|
skilful: "skillful", enrol: "enroll", fulfil: "fulfill", instalment: "installment",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
serialise: "serialize", serialised: "serialized", initialise: "initialize",
|
|
31
|
-
initialised: "initialized", optimise: "optimize", optimised: "optimized",
|
|
32
|
-
summarise: "summarize", categorise: "categorize", categorised: "categorized",
|
|
33
|
-
standardise: "standardize", specialise: "specialize", emphasise: "emphasize",
|
|
34
|
-
criticise: "criticize", authorise: "authorize", authorised: "authorized",
|
|
35
|
-
minimise: "minimize", maximise: "maximize", visualise: "visualize",
|
|
36
|
-
utilise: "utilize", memorise: "memorize", synchronise: "synchronize",
|
|
37
|
-
synchronised: "synchronized",
|
|
39
|
+
...Object.fromEntries(
|
|
40
|
+
Object.entries(ISE_VERBS).flatMap(([gb, us]) =>
|
|
41
|
+
ISE_ENDINGS.map((ending) => [gb.slice(0, -1) + ending, us.slice(0, -1) + ending]),
|
|
42
|
+
),
|
|
43
|
+
),
|
|
38
44
|
};
|
|
39
45
|
|
|
40
46
|
const WORD_RE = new RegExp(`\\b(${Object.keys(WORDS).join("|")})\\b`, "gi");
|