Skip to content

Commit 1247aa9

Browse files
authored
Merge branch 'main' into chore/use-lit
2 parents 41b6e65 + b44b169 commit 1247aa9

File tree

10 files changed

+108
-27
lines changed

10 files changed

+108
-27
lines changed

.prettierrc.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
"semi": true,
77
"bracketSpacing": true,
88
"arrowParens": "always",
9-
"trailingComma": "none",
10-
"bracketSameLine": true
9+
"trailingComma": "es5",
10+
"bracketSameLine": true,
11+
"endOfLine": "lf",
12+
"overrides": [
13+
{
14+
"files": "*.json",
15+
"options": {
16+
"trailingComma": "none"
17+
}
18+
}
19+
]
1120
}

.storybook/main.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const config: StorybookConfig = {
88
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
99
framework: {
1010
name: '@storybook/web-components-vite',
11-
options: {}
11+
options: {},
1212
},
1313
docs: {
14-
autodocs: 'tag'
15-
}
14+
autodocs: 'tag',
15+
},
1616
};
1717

1818
export default config;

.storybook/preview.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const preview: Preview = {
99
controls: {
1010
matchers: {
1111
color: /(background|color)$/i,
12-
date: /Date$/
13-
}
14-
}
15-
}
12+
date: /Date$/,
13+
},
14+
},
15+
},
1616
};
1717

1818
export default preview;

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ npm install @linuxfoundation/lfx-ui-core
2222

2323
## Documentation
2424

25-
- [Design Tokens](docs/design-tokens.md)
26-
- [Footer Component](docs/footer.md)
25+
- Configurations
26+
- [Design Tokens](docs/design-tokens.md)
27+
- [Prettier Configuration](docs/prettier-config.md)
28+
- Components
29+
- [Footer Component](docs/footer.md)
2730

2831
## Contributing
2932

docs/design-tokens.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ import { Aura } from 'primeng/themes/aura';
1414
import { lfxPreset } from '@linuxfoundation/lfx-ui-core';
1515

1616
const customPreset = definePreset(Aura, {
17-
primitive: lfxPreset.primitive
17+
primitive: lfxPreset.primitive,
1818
});
1919

2020
@Component({
2121
selector: 'app-root',
2222
templateUrl: './app.component.html',
23-
styleUrls: ['./app.component.css']
23+
styleUrls: ['./app.component.css'],
2424
})
2525
export class AppComponent {
2626
constructor(private config: PrimeNGConfig) {
2727
this.config.theme.set({
2828
preset: customPreset,
2929
options: {
3030
prefix: 'p',
31-
darkModeSelector: '.dark-mode'
32-
}
31+
darkModeSelector: '.dark-mode',
32+
},
3333
});
3434
}
3535
}
@@ -43,14 +43,14 @@ import { Aura } from 'primeng/themes/aura';
4343
import { lfxPreset } from '@linuxfoundation/lfx-ui-core';
4444

4545
const MyPreset = definePreset(Aura, {
46-
primitive: lfxPreset.primitive
46+
primitive: lfxPreset.primitive,
4747
});
4848

4949
const app = createApp(App);
5050

5151
app.use(PrimeVue, {
5252
theme: {
53-
preset: MyPreset
54-
}
53+
preset: MyPreset,
54+
},
5555
});
5656
```

docs/prettier-config.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Prettier Configuration
2+
3+
The Prettier configuration provides a consistent code style across the projects.
4+
5+
## Configuration
6+
7+
The configuration is defined in `src/core/prettier-config/index.ts`.
8+
9+
## Usage
10+
11+
To use the configuration, add it to your `.prettierrc.js` file in the root of your project:
12+
13+
```javascript
14+
module.exports = require('@linuxfoundation/lfx-ui-core/prettier-config');
15+
```
16+
17+
Add the `.prettierignore` file to the root of your project to ignore files from formatting.
18+
19+
```bash
20+
**/*.*
21+
**/node_modules
22+
**/dist
23+
**/.angular/cache
24+
25+
!src/**/*.html
26+
!src/**/*.ts
27+
!src/**/*.tsx
28+
!src/**/*.js
29+
!src/**/*.jsx
30+
!src/**/*.json
31+
!src/**/*.css
32+
!src/**/*.scss
33+
!src/**/*.md
34+
!src/**/*.mdx
35+
```
36+
37+
> **Note:** The `.prettierignore` file must be present in the top-level directory of your workspace for these ignore patterns to take effect. If you open a workspace subfolder directly and it doesn't contain its own `.prettierignore` file, these ignore settings will not be applied.

package.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,19 @@
4949
"dist",
5050
"dist/browser",
5151
"README.md"
52-
]
52+
],
53+
"exports": {
54+
".": {
55+
"import": "./dist/index.js",
56+
"require": "./dist/index.js"
57+
},
58+
"./components": {
59+
"import": "./dist/components/index.js",
60+
"require": "./dist/components/index.js"
61+
},
62+
"./prettier-config": {
63+
"import": "./dist/core/prettier-config/index.js",
64+
"require": "./dist/core/prettier-config/index.js"
65+
}
66+
}
5367
}

src/components/footer/footer.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const meta: Meta = {
99
title: 'Components/Footer',
1010
component: 'lfx-footer',
1111
parameters: {
12-
layout: 'fullscreen'
12+
layout: 'fullscreen',
1313
},
14-
render: () => html`<lfx-footer></lfx-footer>`
14+
render: () => html`<lfx-footer></lfx-footer>`,
1515
};
1616

1717
export default meta;

src/core/prettier-config/index.ts

+24-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
// Copyright The Linux Foundation and each contributor to LFX.
22
// SPDX-License-Identifier: MIT
33

4-
import { Config } from 'prettier';
5-
6-
const prettierConfig: Config = {
4+
const prettierConfig = {
5+
// 160 is the default for the LF Design System
76
printWidth: 160,
7+
// Use single quotes for strings
88
singleQuote: true,
9+
// Use spaces instead of tabs
910
useTabs: false,
11+
// Set tab width to 2 spaces
1012
tabWidth: 2,
13+
// Add semicolons at the end of statements
1114
semi: true,
15+
// Add spaces inside brackets
1216
bracketSpacing: true,
17+
// Add parentheses around arrow function parameters
1318
arrowParens: 'always',
14-
trailingComma: 'none',
15-
bracketSameLine: true
19+
// Use ES5 trailing commas
20+
trailingComma: 'es5',
21+
// Put the closing bracket on the same line as the last element
22+
bracketSameLine: true,
23+
// Use LF line endings
24+
endOfLine: 'lf',
25+
// Override settings for specific file types
26+
overrides: [
27+
{
28+
files: ['*.json'],
29+
options: {
30+
trailingComma: 'none',
31+
},
32+
},
33+
],
1634
};
1735

1836
module.exports = prettierConfig;
37+
export type PrettierConfig = typeof prettierConfig;

src/scripts/build.ts

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ function generatePresetsIndex(): string {
9191

9292
function generateIndex(): string {
9393
return `export * from './design/presets';
94-
export * from './core/prettier-config';
9594
export * from './components';`;
9695
}
9796

0 commit comments

Comments
 (0)