@mui/internal-code-infra 0.0.2-canary.7 → 0.0.2-canary.8

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/prettier.mjs +38 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.2-canary.7",
3
+ "version": "0.0.2-canary.8",
4
4
  "description": "Infra scripts and configs to be used across MUI repos.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -71,7 +71,7 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitSha": "2c91642f426d2b1c7e7d8419b76933bc3fc18390",
74
+ "gitSha": "53f90246206d907a865ef8e56f7ea061f1a2e8d8",
75
75
  "scripts": {
76
76
  "typescript": "tsc -p tsconfig.json",
77
77
  "test": "pnpm -w test --project @mui/internal-code-infra"
package/src/prettier.mjs CHANGED
@@ -1,34 +1,46 @@
1
1
  /**
2
- * @returns {import('prettier').Options}
2
+ * @typedef {Exclude<import('prettier').Config['overrides'], undefined>[number]} Override
3
3
  */
4
- export function createBaseConfig() {
4
+
5
+ /**
6
+ * @type {Override[]}
7
+ */
8
+ export const docsOverrides = [
9
+ {
10
+ files: [
11
+ 'docs/**/*.md',
12
+ 'docs/src/pages/**/*.{js,tsx}',
13
+ 'docs/src/app/**/*.{js,tsx}',
14
+ 'docs/data/**/*.{js,tsx}',
15
+ ],
16
+ options: {
17
+ // otherwise code blocks overflow on the docs website
18
+ // The container is 751px
19
+ printWidth: 85,
20
+ },
21
+ },
22
+ ];
23
+
24
+ /**
25
+ * @type {Override}
26
+ */
27
+ const jsonOverride = {
28
+ files: ['**/*.json'],
29
+ options: {
30
+ trailingComma: 'none',
31
+ },
32
+ };
33
+
34
+ /**
35
+ * @param {Object} [options={}]
36
+ * @param {Override[]} [options.overrides]
37
+ * @returns {import('prettier').Config}
38
+ */
39
+ export function createBaseConfig(options = {}) {
5
40
  return {
6
41
  printWidth: 100,
7
42
  singleQuote: true,
8
43
  trailingComma: 'all',
9
- overrides: [
10
- {
11
- files: ['docs/**/*.md', 'docs/src/pages/**/*.{js,tsx}', 'docs/data/**/*.{js,tsx}'],
12
- options: {
13
- // otherwise code blocks overflow on the docs website
14
- // The container is 751px
15
- printWidth: 85,
16
- },
17
- },
18
- {
19
- files: ['docs/pages/blog/**/*.md'],
20
- options: {
21
- // otherwise code blocks overflow on the blog website
22
- // The container is 692px
23
- printWidth: 82,
24
- },
25
- },
26
- {
27
- files: ['**/*.json'],
28
- options: {
29
- trailingComma: 'none',
30
- },
31
- },
32
- ],
44
+ overrides: [jsonOverride, ...(options.overrides ?? [])],
33
45
  };
34
46
  }