@elnop/alint-config 0.0.0-stage → 0.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.
Files changed (3) hide show
  1. package/README.md +31 -2
  2. package/base.yml +35 -0
  3. package/package.json +30 -4
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # @elnop/alint-config
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [alint](https://github.com/asamarts/alint) rules for a repository:
4
+
5
+ | Rule | Checks |
6
+ | --------------------------- | -------------------------------------------------------------------------------------------- |
7
+ | `doc-links-resolve` | every file link in `README.md` and `docs/**/*.md` points to a file that exists |
8
+ | `doc-fragments-resolve` | every anchor in those links matches a heading |
9
+ | `styles-only-css` | a `styles/` folder only holds `.css` files |
10
+ | `types-only-types-files` | a `types/` folder only holds `XTypes.ts` files |
11
+ | `configs-only-config-files` | a `configs/` folder only holds `XConfig.ts` files and their tests |
12
+ | `exact-dependency-versions` | every `dependencies` and `devDependencies` entry of every `package.json` is an exact version |
13
+
14
+ ```sh
15
+ npm install --save-dev @elnop/alint-config @asamarts/alint
16
+ ```
17
+
18
+ `.alint.yml`:
19
+
20
+ ```yaml
21
+ version: 1
22
+ extends:
23
+ - ./node_modules/@elnop/alint-config/base.yml
24
+ rules:
25
+ - id: doc-paths-resolve
26
+ kind: markdown_paths_resolve
27
+ paths: ['README.md', 'docs/**/*.md']
28
+ prefixes: ['src/', 'docs/']
29
+ level: error
30
+ ```
31
+
32
+ alint only follows a local `extends` that stays inside the linted tree, so the path goes through `node_modules`. `markdown_paths_resolve` stays in your file because its `prefixes` depend on your folders. alint downloads its binary in a `postinstall` script, which npm 11 runs only once you approve it (`allowScripts` in `package.json`).
package/base.yml ADDED
@@ -0,0 +1,35 @@
1
+ version: 1
2
+ rules:
3
+ - id: doc-links-resolve
4
+ kind: markdown_links_resolve
5
+ paths: ['README.md', 'docs/**/*.md']
6
+ level: error
7
+ - id: doc-fragments-resolve
8
+ kind: markdown_fragments_resolve
9
+ paths: ['README.md', 'docs/**/*.md']
10
+ level: error
11
+ - id: styles-only-css
12
+ kind: dir_only_contains
13
+ select: '**/styles'
14
+ allow: ['*.css']
15
+ message: 'A styles/ folder only holds stylesheets: move this file next to its code.'
16
+ level: error
17
+ - id: types-only-types-files
18
+ kind: dir_only_contains
19
+ select: '**/types'
20
+ allow: ['*Types.ts']
21
+ message: 'A types/ folder only holds XTypes.ts files: move this file or rename it after its domain.'
22
+ level: error
23
+ - id: configs-only-config-files
24
+ kind: dir_only_contains
25
+ select: '**/configs'
26
+ allow: ['*Config.ts', '*Config.test.ts']
27
+ message: 'A configs/ folder only holds XConfig.ts files and their tests: move this file next to its code, and JSX into a component.'
28
+ level: error
29
+ - id: exact-dependency-versions
30
+ kind: json_path_matches
31
+ paths: ['**/package.json']
32
+ path: '$["dependencies","devDependencies"].*'
33
+ matches: '^\d+\.\d+\.\d+$'
34
+ message: 'Pin each dependency to an exact version (add save-exact=true to .npmrc so npm install writes them exact).'
35
+ level: error
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@elnop/alint-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "alint rules for a repository: category folders hold only their kind, every dependency is pinned, doc links and anchors resolve.",
5
+ "keywords": [
6
+ "alint",
7
+ "repository",
8
+ "lint"
9
+ ],
10
+ "homepage": "https://github.com/Elnop/elnop-tooling/tree/main/packages/configs/alint-config#readme",
11
+ "bugs": "https://github.com/Elnop/elnop-tooling/issues",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Elnop/elnop-tooling.git",
15
+ "directory": "packages/configs/alint-config"
16
+ },
17
+ "license": "MIT",
18
+ "author": "elnop",
19
+ "type": "module",
20
+ "files": [
21
+ "base.yml"
22
+ ],
23
+ "scripts": {
24
+ "test": "node --test '**/*.test.ts'"
25
+ },
26
+ "peerDependencies": {
27
+ "@asamarts/alint": "0.21.0"
28
+ },
29
+ "devDependencies": {
30
+ "@asamarts/alint": "0.21.0"
31
+ }
32
+ }