Skip to content

Commit fb72cc2

Browse files
authored
Merge pull request #121 from rcpch/testing-and-linting
Testing-and-linting
2 parents af45a65 + b98234f commit fb72cc2

File tree

169 files changed

+421291
-386585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+421291
-386585
lines changed

.babelrc.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"sourceType": "unambiguous",
3-
"presets": [
4-
[
5-
"@babel/preset-env",
6-
{
7-
"targets": {
8-
"chrome": 100
9-
}
10-
}
2+
"sourceType": "unambiguous",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": 100
9+
}
10+
}
11+
],
12+
"@babel/preset-typescript",
13+
"@babel/preset-react"
1114
],
12-
"@babel/preset-typescript",
13-
"@babel/preset-react"
14-
],
15-
"plugins": []
15+
"plugins": []
1616
}

.eslintrc.js

+24-21
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
module.exports = {
22
env: {
3-
browser: true,
4-
es2021: true,
3+
browser: true,
4+
es2021: true,
55
},
6-
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
6+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
77
parserOptions: {
8-
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
9-
sourceType: "module", // Allows for the use of imports
10-
ecmaFeatures: {
11-
jsx: true // Allows for the parsing of JSX
12-
}
8+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
9+
sourceType: 'module', // Allows for the use of imports
10+
ecmaFeatures: {
11+
jsx: true, // Allows for the parsing of JSX
12+
},
1313
},
1414
settings: {
15-
react: {
16-
version: "detect" // Tells eslint-plugin-react to automatically detect the version of React to use
17-
}
15+
react: {
16+
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
17+
},
1818
},
1919
extends: [
20-
"plugin:react/recommended",
21-
"airbnb-typescript",
22-
"plugin:@typescript-eslint/recommended",
23-
"prettier/@typescript-eslint",
24-
"plugin:prettier/recommended",
25-
"plugin:storybook/recommended"
20+
'eslint:recommended',
21+
'plugin:react/recommended',
22+
'airbnb-typescript',
23+
'plugin:@typescript-eslint/recommended',
24+
'plugin:prettier/recommended',
25+
'plugin:storybook/recommended',
26+
'prettier',
27+
'prettier/@typescript-eslint',
28+
'prettier/react',
2629
],
2730
rules: {
28-
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
29-
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
31+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
32+
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
3033
},
3134
plugins: ['react', '@typescript-eslint', 'prettier'],
3235
rules: {
33-
'prettier/prettier': 'error',
36+
'prettier/prettier': 'error',
3437
},
35-
};
38+
};
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
name: Adds new Issues automatically to the dGC Project
22

33
on:
4-
issues:
5-
types:
6-
- opened
7-
pull_request:
8-
types:
9-
- opened
4+
issues:
5+
types:
6+
- opened
7+
pull_request:
8+
types:
9+
- opened
1010

1111
jobs:
12-
add-to-project:
13-
name: Add issue or PR to project automatically
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/add-to-project@v0.4.0
17-
with:
18-
project-url: https://github.com/orgs/rcpch/projects/5 #dGC Project
19-
github-token: ${{ secrets.AUTO_ADD_TO_PROJECT_TOKEN }}
20-
12+
add-to-project:
13+
name: Add issue or PR to project automatically
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/add-to-project@v0.4.0
17+
with:
18+
project-url: https://github.com/orgs/rcpch/projects/5 #dGC Project
19+
github-token: ${{ secrets.AUTO_ADD_TO_PROJECT_TOKEN }}

.github/workflows/check.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
name: Check build and tests on PR and merge to live
22

33
on:
4-
pull_request:
5-
branches:
6-
- "*"
7-
push:
8-
branches:
9-
- live
4+
pull_request:
5+
branches:
6+
- '*'
7+
push:
8+
branches:
9+
- live
1010

1111
jobs:
12-
build:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
17-
with:
18-
node-version: "20.x"
19-
registry-url: "https://registry.npmjs.org"
20-
- run: npm install
21-
- run: npm run build
22-
- run: npm test
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: '20.x'
19+
registry-url: 'https://registry.npmjs.org'
20+
- run: npm install
21+
- run: npm run build
22+
- run: npm test

.github/workflows/publish.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ name: NPM Publish
33

44
# This action will publish to NPM on every new release
55
on:
6-
release:
7-
types: [created]
6+
release:
7+
types: [created]
88

99
# Job will run on a ubuntu instance
1010
jobs:
11-
build:
12-
runs-on: ubuntu-latest
13-
steps:
14-
# Checkout the code
15-
- uses: actions/checkout@v4
16-
# Setup node with version 20.x and NPM registry url
17-
- uses: actions/setup-node@v4
18-
with:
19-
node-version: "20.x"
20-
registry-url: "https://registry.npmjs.org"
21-
# Run npm install to install project packages
22-
- run: npm install
23-
# npm build to build the project
24-
- run: npm run build
25-
# publish the files to NPM
26-
- run: npm publish --access public
27-
# for publishing, npm need authorization. We add the NPM token to the environment which will take care of authorization to publish to the package
28-
env:
29-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Checkout the code
15+
- uses: actions/checkout@v4
16+
# Setup node with version 20.x and NPM registry url
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
# Run npm install to install project packages
22+
- run: npm install
23+
# npm build to build the project
24+
- run: npm run build
25+
# publish the files to NPM
26+
- run: npm publish --access public
27+
# for publishing, npm need authorization. We add the NPM token to the environment which will take care of authorization to publish to the package
28+
env:
29+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
build

.prettierrc.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
semi: true,
3-
trailingComma: "all",
3+
trailingComma: 'all',
44
singleQuote: true,
55
printWidth: 120,
6-
tabWidth: 4
7-
};
6+
tabWidth: 4,
7+
};

.storybook/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ const config: StorybookConfig = {
2626
},
2727
docs: {
2828
autodocs: 'tag',
29-
}
29+
},
3030
};
3131
export default config;

.vscode/settings.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
"editor.codeActionsOnSave": {
33
"source.fixAll": "explicit"
44
},
5-
"git.enableCommitSigning": true
5+
"git.enableCommitSigning": true,
6+
{
7+
"editor.formatOnSave": true,
8+
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
}
610
}

CSSStub.js __mocks__/styleMock.ts

File renamed without changes.

fileTransformer.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const path = require("path");
1+
const path = require('path');
22

33
module.exports = {
4-
process(sourceText, sourcePath, options) {
5-
return {
6-
code: `module.exports = ${JSON.stringify(path.basename(sourcePath))};`,
7-
};
8-
},
4+
process(sourceText, sourcePath, options) {
5+
return {
6+
code: `module.exports = ${JSON.stringify(path.basename(sourcePath))};`,
7+
};
8+
},
99
};

jest.config.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import type {Config} from 'jest';
1+
import type { Config } from 'jest';
22

33
const config: Config = {
44
preset: 'ts-jest',
55
verbose: true,
6-
moduleFileExtensions: ["js", "jsx", "ts", "tsx"],
7-
moduleDirectories: ["node_modules", "src"],
6+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
7+
moduleDirectories: ['node_modules', 'src'],
88
transform: {
99
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
10-
'<rootDir>/fileTransformer.js',
10+
'<rootDir>/fileTransformer.js',
11+
},
12+
moduleNameMapper: {
13+
'\\.(css|less|scss|sass)$': '<rootDir>/__mocks__/styleMock.ts',
1114
},
12-
moduleNameMapper:{
13-
"\\.(css|less|sass|scss)$": '<rootDir>/CSSStub.js'
14-
}
1515
};
1616

17-
export default config;
17+
export default config;

0 commit comments

Comments
 (0)