Skip to content

Commit 0f6e678

Browse files
Upgrade NHS Prototype kit to version 7 (#453)
This upgrades the prototype to version 7 of the NHS Prototype Kit. This is a manual process of copying the files over and merging any changes - see https://prototype-kit.service-manual.nhs.uk/how-tos/updating-the-kit We had already update to NHS Frontend version 10 in #443, so this is mainly copying over some improvements and bug fixes to the kit itself.
1 parent a3ed159 commit 0f6e678

Some content is hidden

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

41 files changed

+21254
-8797
lines changed

.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+
*/

.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)