Skip to content

Commit 0ca8099

Browse files
Merge pull request #142 from NHSDigital/nhsuk-frontend-v10
Update to NHS.UK frontend v10 + other updates
2 parents d94ca00 + 2b3cb3b commit 0ca8099

File tree

169 files changed

+14754
-30763
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

+14754
-30763
lines changed

.babelrc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
{
2-
"presets": ["@babel/preset-env"]
2+
"browserslistEnv": "javascripts",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"bugfixes": true,
8+
"loose": true
9+
}
10+
]
11+
],
12+
"env": {
13+
"test": {
14+
"browserslistEnv": "node"
15+
}
16+
}
317
}

.browserslistrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[javascripts]
2+
supports es6-module
3+
4+
[stylesheets]
5+
> 0.1% in GB and not dead
6+
last 6 Chrome versions
7+
last 6 Firefox versions
8+
last 6 Edge versions
9+
last 2 Samsung versions
10+
Firefox ESR
11+
Safari >= 11
12+
iOS >= 11
13+
IE 11
14+
15+
[node]
16+
node 22

.editorconfig

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*.scss]
5+
indent_size = 2
6+
indent_style = space
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.{html,njk}]
13+
indent_size = 2
14+
indent_style = space
15+
charset = utf-8
16+
end_of_line = lf
17+
insert_final_newline = true
18+
trim_trailing_whitespace = true
19+
20+
[*.{cjs,js,mjs}]
21+
indent_size = 2
22+
indent_style = space
23+
charset = utf-8
24+
end_of_line = lf
25+
insert_final_newline = true
26+
trim_trailing_whitespace = true
27+
28+
[*.json]
29+
indent_size = 2
30+
indent_style = space
31+
charset = utf-8
32+
end_of_line = lf
33+
insert_final_newline = true
34+
trim_trailing_whitespace = true
35+
36+
[*.{yml,yaml}]
37+
indent_size = 2
38+
indent_style = space
39+
charset = utf-8
40+
end_of_line = lf
41+
insert_final_newline = true
42+
trim_trailing_whitespace = true
43+
44+
[**public**]
45+
indent_size = unset
46+
indent_style = unset
47+
charset = unset
48+
end_of_line = unset
49+
insert_final_newline = unset
50+
trim_trailing_whitespace = unset
51+
max_line_length = unset

.eslintrc.js

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
/**
2+
* @type {ESLint.ConfigData}
3+
*/
4+
module.exports = {
5+
extends: ['prettier'],
6+
ignorePatterns: [
7+
'**/app/**',
8+
'**/public/**',
9+
10+
// Enable dotfile linting
11+
'!.*',
12+
'node_modules',
13+
'node_modules/.*',
14+
15+
// Prevent CHANGELOG history changes
16+
'CHANGELOG.md'
17+
],
18+
overrides: [
19+
{
20+
files: ['**/*.{cjs,js,mjs}'],
21+
extends: [
22+
'eslint:recommended',
23+
'plugin:import/recommended',
24+
'plugin:jest/style',
25+
'plugin:jest-dom/recommended',
26+
'plugin:jsdoc/recommended-typescript-flavor',
27+
'plugin:n/recommended',
28+
'plugin:promise/recommended',
29+
'plugin:@typescript-eslint/strict',
30+
'plugin:@typescript-eslint/stylistic',
31+
'prettier'
32+
],
33+
parser: '@typescript-eslint/parser',
34+
parserOptions: {
35+
ecmaVersion: 'latest'
36+
},
37+
plugins: [
38+
'@typescript-eslint',
39+
'import',
40+
'jsdoc',
41+
'n',
42+
'promise',
43+
'jest',
44+
'jest-dom'
45+
],
46+
rules: {
47+
// Always import Node.js packages from `node:*`
48+
'import/enforce-node-protocol-usage': ['error', 'always'],
49+
50+
// Check import or require statements are A-Z ordered
51+
'import/order': [
52+
'error',
53+
{
54+
'alphabetize': { order: 'asc' },
55+
'newlines-between': 'always'
56+
}
57+
],
58+
59+
// Check for valid formatting
60+
'jsdoc/check-line-alignment': [
61+
'warn',
62+
'never',
63+
{
64+
wrapIndent: ' '
65+
}
66+
],
67+
68+
// JSDoc blocks are optional by default
69+
'jsdoc/require-jsdoc': 'off',
70+
71+
// Require hyphens before param description
72+
// Aligns with TSDoc style: https://tsdoc.org/pages/tags/param/
73+
'jsdoc/require-hyphen-before-param-description': 'warn',
74+
75+
// JSDoc @param required in (optional) blocks but
76+
// @param description is not necessary by default
77+
'jsdoc/require-param-description': 'off',
78+
'jsdoc/require-param-type': 'error',
79+
'jsdoc/require-param': 'off',
80+
81+
// JSDoc @returns is optional
82+
'jsdoc/require-returns-description': 'off',
83+
'jsdoc/require-returns-type': 'off',
84+
'jsdoc/require-returns': 'off',
85+
86+
// Maintain new line after description
87+
'jsdoc/tag-lines': [
88+
'warn',
89+
'never',
90+
{
91+
startLines: 1
92+
}
93+
]
94+
},
95+
settings: {
96+
jsdoc: {
97+
// Allows us to use type declarations that exist in our dependencies
98+
mode: 'typescript'
99+
}
100+
}
101+
},
102+
{
103+
// CommonJS modules allow require statements
104+
files: ['**/*.{cjs,js}'],
105+
rules: {
106+
'@typescript-eslint/no-require-imports': 'off',
107+
'@typescript-eslint/no-var-requires': 'off'
108+
}
109+
},
110+
{
111+
// ES modules mandatory file extensions
112+
files: ['**/*.mjs'],
113+
rules: {
114+
'import/extensions': [
115+
'error',
116+
'always',
117+
{
118+
ignorePackages: true,
119+
pattern: {
120+
cjs: 'always',
121+
js: 'always',
122+
mjs: 'always'
123+
}
124+
}
125+
]
126+
}
127+
},
128+
{
129+
// Configure ESLint in test files
130+
files: ['**/*.test.{cjs,js,mjs}'],
131+
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
132+
env: {
133+
'jest/globals': true
134+
},
135+
plugins: ['jest']
136+
},
137+
{
138+
// Configure ESLint in browser JavaScript
139+
files: ['app/assets/**/*.{cjs,js,mjs}'],
140+
excludedFiles: ['app/assets/**/*.test.{cjs,js,mjs}'],
141+
env: {
142+
browser: true
143+
},
144+
parserOptions: {
145+
// Note: Allow ES2015 for import/export syntax
146+
ecmaVersion: '2015'
147+
}
148+
}
149+
],
150+
root: true
151+
}
152+
153+
/**
154+
* @import { ESLint } from 'eslint'
155+
*/

.github/ISSUE_TEMPLATE/BUG_REPORT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Use the following headings as a guide.
1717
## What is the issue?
1818

1919
<!-- Provide a detailed description of what the issue is, including what you
20-
expected to happen as well as what actually happened.
20+
expected to happen as well as what actually happened.
2121
-->
2222

2323
## What steps are required to reproduce the issue?
@@ -36,9 +36,9 @@ Include the following as a minimum e.g.
3636
* Browser: Google Chrome
3737
-->
3838

39-
* Device:
40-
* Operating System:
41-
* Browser:
39+
- Device:
40+
- Operating System:
41+
- Browser:
4242

4343
## Is there anything else you think would be useful in recreating the issue?
4444

.github/workflows/pull-request.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Pull request
22

3-
on:
3+
on:
44
pull_request:
55
branches:
6-
- master
6+
- master
77
push:
88
branches:
9-
- master
9+
- master
1010

1111
jobs:
1212
build:
@@ -15,10 +15,10 @@ jobs:
1515
if: github.repository == 'nhsuk/nhsuk-prototype-kit'
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
20-
- name: Install dependencies
21-
run: npm install
22-
23-
- name: Run linting
24-
run: npm run lint:js
18+
- uses: actions/checkout@v4
19+
20+
- name: Install dependencies
21+
run: npm install
22+
23+
- name: Run linting
24+
run: npm run lint:js

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Install dependencies
2323
run: npm install
24-
24+
2525
- name: Running Build
2626
run: npm run build
2727

@@ -36,6 +36,6 @@ jobs:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3737
with:
3838
tag_name: ${{ github.ref }}
39-
release_name: ${{ github.ref }}
39+
release_name: ${{ github.ref }}
4040
draft: false
4141
prerelease: false

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ jspm_packages/
5454
# Optional npm cache directory
5555
.npm
5656

57-
# Optional eslint cache
58-
.eslintcache
59-
6057
# Optional REPL history
6158
.node_repl_history
6259

@@ -75,3 +72,6 @@ Thumbs.db
7572

7673
# Code coverage
7774
coverage
75+
76+
# ESlint cache
77+
.cache

.prettierignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Temporary only
2+
.cache/
3+
4+
# Application
5+
app/
6+
7+
# Node.js modules
8+
node_modules/
9+
10+
# Build output
11+
public/
12+
13+
# Files to ignore
14+
*.html
15+
*.min.js
16+
package-lock.json

.prettierrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @type {Config}
3+
*/
4+
module.exports = {
5+
quoteProps: 'consistent',
6+
semi: false,
7+
singleQuote: true,
8+
trailingComma: 'none',
9+
overrides: [
10+
{
11+
files: '*.md',
12+
options: {
13+
embeddedLanguageFormatting: 'off',
14+
singleQuote: false
15+
}
16+
},
17+
{
18+
files: '*.scss',
19+
options: {
20+
printWidth: 120,
21+
singleQuote: false
22+
}
23+
}
24+
]
25+
}
26+
27+
/**
28+
* @import { Config } from 'prettier'
29+
*/

0 commit comments

Comments
 (0)