Skip to content

Commit

Permalink
chore: add code formatting with Prettier (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
DRiFTy17 authored Jun 7, 2024
1 parent 22a1ea1 commit e8d3c40
Show file tree
Hide file tree
Showing 776 changed files with 10,453 additions and 8,521 deletions.
16 changes: 4 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,19 @@
],
"overrides": [
{
"files": [
"*.js",
"*.ts"
],
"files": ["*.js", "*.ts"],
"parserOptions": {
"project": [
"tsconfig.json"
],
"project": ["tsconfig.json"],
"tsconfigRootDir": ".",
"createDefaultProgram": true
},
"extends": [
"plugin:@tylertech-eslint/recommended"
],
"extends": ["plugin:@tylertech-eslint/recommended", "plugin:prettier/recommended"],
"rules": {
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-empty-interface": ["error", { "allowSingleExtends": true }],
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/comma-dangle": ["error"],
"@typescript-eslint/comma-spacing": ["error"],
"@typescript-eslint/no-extra-parens": ["error", "all", { "nestedBinaryExpressions": false }],
"@typescript-eslint/explicit-member-accessibility": ["error", { "overrides": { "constructors": "no-public" } }],
"@typescript-eslint/arrow-body-style": "off",
"@typescript-eslint/no-require-imports": "error",
Expand All @@ -46,7 +38,7 @@
"no-extra-parens": "off",
"max-len": "off",
"arrow-body-style": "off",
"eqeqeq": ["error", "always", {"null": "ignore"}]
"eqeqeq": ["error", "always", { "null": "ignore" }]
}
}
]
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/deploy-storybook.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code Style

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
prettier:
name: Prettier
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4

- name: Cache Dependencies
id: cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: npm ci

- name: Prettier Check
run: npm run prettier:check
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.github/
.husky/
.storybook/
.storybook-static/
.coverage/
dist/
docs/
node_modules/
src/dev/
src/test/
package-lock.json
CONTRIBUTING.md
CHANGELOG.md
README.md
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"bracketSameLine": true,
"printWidth": 160,
"singleQuote": true,
"trailingComma": "none"
}
4 changes: 2 additions & 2 deletions .storybook/_preview-storybook.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ blockquote {
// Tables
//

.sbdocs.sbdocs-content table :is(td,th) {
.sbdocs.sbdocs-content table :is(td, th) {
color: var(--forge-theme-text-high);
border-color: var(--forge-theme-outline);
}
Expand All @@ -75,7 +75,7 @@ blockquote {

.sbdocs code > span {
font: inherit;

> a {
font: inherit;
color: var(--forge-theme-primary);
Expand Down
2 changes: 1 addition & 1 deletion .storybook/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ addons.setConfig({
filters: {
hidden: item => !item.tags?.includes('hidden')
}
},
}
});
10 changes: 5 additions & 5 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />

<link rel="shortcut icon" href="https://cdn.forge.tylertech.com/favicon.ico">
<link rel="stylesheet" href="https://cdn.forge.tylertech.com/v1/css/tyler-font.css">
<link rel="shortcut icon" href="https://cdn.forge.tylertech.com/favicon.ico" />
<link rel="stylesheet" href="https://cdn.forge.tylertech.com/v1/css/tyler-font.css" />
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The `forge.css` file contains other stylesheets that you may or may not need. We
Additionally, apply the `forge-typography` class to a root element (typically the `<body>`):

```html
<body class="forge-typography">
<body class="forge-typography"></body>
```

### Using via CDN
Expand All @@ -116,14 +116,16 @@ As an example, the text-field and button components can be loaded directly like

```html
<!-- Optionally include a minimal base set of styles commonly used with Forge-based applications -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/forge-core.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/forge-core.css" />

<!-- Always include the theme and typography styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/theme/forge-theme.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/typography/forge-typography.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/theme/forge-theme.css" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/typography/forge-typography.css" />

<!-- Some components (such as button) require the use of a global stylesheet (for now) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/button/forge-button.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/button/forge-button.css" />

<!-- Load the ES modules JavaScript for each component you need -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@tylertech/forge@2.0.0/dist/esm/text-field/index.js"></script>
Expand All @@ -146,7 +148,7 @@ Now the text-field and button components can be used anywhere in the DOM:
Don't forget to also add the `forge-typography` class to the `<body>` element to ensure your application inherits the default typography styles:

```html
<body class="forge-typography">
<body class="forge-typography"></body>
```

## Need help?
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js → commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [0, 'always', 100],
Expand Down
8 changes: 4 additions & 4 deletions custom-elements-manifest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export default {
tags: {
dependency: {
mappedName: 'dependencies',
isArray: true,
isArray: true
},
globalconfig: {
mappedName: 'globalConfigProperties',
isArray: true,
},
isArray: true
}
}
}),
})
]
};
4 changes: 1 addition & 3 deletions forge.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"header": "/**\n * @license\n * Copyright Tyler Technologies, Inc. \n * License: Apache-2.0\n */\n"
},
"karma": {
"stylesheets": [
"src/lib/forge.scss"
]
"stylesheets": ["src/lib/forge.scss"]
},
"packageConfig": {
"copyFiles": [
Expand Down
Loading

0 comments on commit e8d3c40

Please sign in to comment.