@mslmio/eslint-config 1.2.0 → 2.0.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 -8
- package/index.js +0 -8
- package/package.json +2 -2
- package/plugin.js +1 -1
- package/rules/no-lib-process-env.js +3 -2
- package/rules/no-module-scope-init.js +1 -1
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 |
|
|
@@ -78,13 +78,6 @@ A file's namespace is its top-level directory under that root, so neither the pa
|
|
|
78
78
|
checked out at nor the package's own name changes the verdict. Outside a workspace there is no root,
|
|
79
79
|
and a scoped package's scope is its namespace.
|
|
80
80
|
|
|
81
|
-
## Ignores
|
|
82
|
-
|
|
83
|
-
`house`, and so every preset, globally ignores `.design-sync/**`, `.ds-sync/**` and
|
|
84
|
-
`ds-bundle/**`. Flat config does not read `.gitignore`, and these hold symlinks into app
|
|
85
|
-
components — one moved component leaves a dangling link and `eslint .` exits `ENOENT` instead of
|
|
86
|
-
reporting anything.
|
|
87
|
-
|
|
88
81
|
## License
|
|
89
82
|
|
|
90
83
|
MIT
|
package/index.js
CHANGED
|
@@ -4,13 +4,6 @@ import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
|
4
4
|
|
|
5
5
|
const TS_GLOBS = ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.js", "**/*.mjs"];
|
|
6
6
|
|
|
7
|
-
// design-sync scratch and its generated bundle. All three are gitignored, and `ds-src` holds
|
|
8
|
-
// symlinks that dangle the moment a component moves - which makes `eslint .` exit on ENOENT
|
|
9
|
-
// rather than report. Flat config does not read .gitignore, so every consumer needs this.
|
|
10
|
-
export const designSyncIgnores = {
|
|
11
|
-
ignores: [".design-sync/**", ".ds-sync/**", "ds-bundle/**"],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
7
|
// The @typescript-eslint rule set. Without this the parser parses TypeScript and
|
|
15
8
|
// NOTHING lints it - no unused vars, no floating promises, no unsafe any. The rules
|
|
16
9
|
// go in `house` (so every consumer gets them) while the PARSER stays out of it, since
|
|
@@ -42,7 +35,6 @@ typescriptRules.push({
|
|
|
42
35
|
|
|
43
36
|
// Every rule here encodes a documented house rule. Adding one means editing
|
|
44
37
|
export const house = [
|
|
45
|
-
designSyncIgnores,
|
|
46
38
|
...typescriptRules,
|
|
47
39
|
{
|
|
48
40
|
files: TS_GLOBS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mslmio/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Shareable ESLint flat config and house rules: US spelling, library hygiene, workspace layering, and Tailwind/React conventions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"eslint-plugin",
|
|
10
10
|
"flat-config",
|
|
11
11
|
"typescript",
|
|
12
|
-
"
|
|
12
|
+
"workspace",
|
|
13
13
|
"layering",
|
|
14
14
|
"tailwind",
|
|
15
15
|
"react"
|
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.0.1" },
|
|
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) {
|