skyltmax_config 2.0.0 → 3.0.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.
@@ -0,0 +1,33 @@
1
+ // Vendored replacement for `prettier-plugin-ignored` (1.0.0 — one release ever, 2024-08-30, single maintainer). The
2
+ // package was 20 lines of no-op parser/printer; owning them here removes a registry dependency from every consumer's
3
+ // tree without changing behaviour.
4
+ //
5
+ // Why the shape exists at all: prettier has no shareable ignore mechanism. `.prettierignore`, `--ignore-path` and
6
+ // `.gitignore` all live in the consumer's repo, so a shared config can only exclude a file by formatting it to exactly
7
+ // what it already was. The parser hands the source through untouched and the printer prints it back verbatim; an
8
+ // `overrides` entry in `prettier.js` opts a glob in via `parser: "ignored"`.
9
+
10
+ /** @type {import("prettier").SupportLanguage[]} */
11
+ export const languages = [
12
+ {
13
+ name: "ignored",
14
+ parsers: ["ignored"],
15
+ },
16
+ ]
17
+
18
+ /** @type {Record<string, import("prettier").Parser<string>>} */
19
+ export const parsers = {
20
+ ignored: {
21
+ parse: source => source,
22
+ astFormat: "ignored-ast",
23
+ locStart: () => 0,
24
+ locEnd: node => node.length,
25
+ },
26
+ }
27
+
28
+ /** @type {Record<string, import("prettier").Printer<string>>} */
29
+ export const printers = {
30
+ "ignored-ast": {
31
+ print: path => path.node ?? "",
32
+ },
33
+ }
data/prettier.js CHANGED
@@ -46,9 +46,10 @@ export const config = {
46
46
  },
47
47
  },
48
48
  ],
49
- // Resolved from this package's own dependencies. Bare names would be resolved by prettier's import() from the
50
- // consumer's context, which is exactly the phantom-dependency setup v2 removes.
51
- plugins: [import.meta.resolve("prettier-plugin-ignored"), import.meta.resolve("prettier-plugin-tailwindcss")],
49
+ // Resolved from this package itself the `ignored` parser is vendored here, tailwindcss comes from our own
50
+ // dependencies. Bare names would be resolved by prettier's import() from the consumer's context, which is exactly
51
+ // the phantom-dependency setup v2 removes.
52
+ plugins: [import.meta.resolve("./prettier-ignored-plugin.js"), import.meta.resolve("prettier-plugin-tailwindcss")],
52
53
  tailwindAttributes: ["class", "className", ".*[cC]lassName"],
53
54
  tailwindFunctions: ["clsx", "cn", "twcn"],
54
55
  }
data/reset.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ // `/dom` is the whole `recommended` set (filter-boolean, json-parse, is-array, includes/has/indexOf, promise-catch,
2
+ // map-constructor) plus the Storage overrides — importing any of those entrypoints separately is a no-op.
1
3
  import "@total-typescript/ts-reset/dom"
2
- import "@total-typescript/ts-reset/filter-boolean"
3
4
 
4
5
  import "react"
5
6
 
@@ -1,3 +1,4 @@
1
+ import { format } from "prettier"
1
2
  import { describe, expect, test } from "vitest"
2
3
 
3
4
  import { config as eslintConfig } from "../eslint.js"
@@ -13,17 +14,33 @@ describe("prettier config", () => {
13
14
  await expect(import(plugin)).resolves.toBeDefined()
14
15
  }
15
16
  })
17
+
18
+ // The vendored `ignored` parser (prettier-ignored-plugin.js) is how the shared config excludes files without a
19
+ // .prettierignore in the consumer's repo — it has to return the source byte for byte, whitespace included.
20
+ test("the ignored parser formats a file to exactly its input", async () => {
21
+ const source = "packages:\n - 'apps/*'\n\n\n trailing spaces \n"
22
+
23
+ await expect(format(source, { parser: "ignored", plugins: prettierConfig.plugins })).resolves.toBe(source)
24
+ })
25
+
26
+ test("the pnpm manifests are the globs routed to the ignored parser", () => {
27
+ const ignoredGlobs = prettierConfig.overrides
28
+ .filter(override => override.options.parser === "ignored")
29
+ .flatMap(override => override.files)
30
+
31
+ expect(ignoredGlobs).toEqual(["**/pnpm-lock.yaml", "**/pnpm-workspace.yaml"])
32
+ })
16
33
  })
17
34
 
18
35
  // Every plugin eslint.js loads, alphabetically. All of them resolve from this package's own dependencies, so a missing
19
36
  // entry means a dependency or an import in eslint.js broke — never a consumer misconfiguration.
20
37
  const EXPECTED_ESLINT_PLUGINS = [
38
+ "@eslint-react",
21
39
  "@typescript-eslint",
22
40
  "import",
23
41
  "jest-dom",
24
42
  "jsx-a11y",
25
43
  "prettier",
26
- "react",
27
44
  "react-hooks",
28
45
  "testing-library",
29
46
  "vitest",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyltmax_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Signmax AB
@@ -110,6 +110,7 @@ files:
110
110
  - fixture/pnpm-workspace.yaml
111
111
  - fixture/src/index.ts
112
112
  - fixture/src/ui/button.tsx
113
+ - fixture/src/ui/card.tsx
113
114
  - fixture/tsconfig.json
114
115
  - index.js
115
116
  - lib/skyltmax_config.rb
@@ -117,6 +118,7 @@ files:
117
118
  - package.json
118
119
  - pnpm-lock.yaml
119
120
  - pnpm-workspace.yaml
121
+ - prettier-ignored-plugin.js
120
122
  - prettier.js
121
123
  - reset.d.ts
122
124
  - rubocop.rails.yml