Skip to content

Commit 9045dda

Browse files
authored
chore(prettier): full repo linting and code reformatting once and for all (OHIF#3627)
1 parent 01500a2 commit 9045dda

File tree

656 files changed

+21753
-20644
lines changed

Some content is hidden

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

656 files changed

+21753
-20644
lines changed

.circleci/config.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ jobs:
269269
git config --global user.name "ohif-bot"
270270
- run:
271271
name: Authenticate with NPM registry
272-
command:
273-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
272+
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
274273
- run:
275274
name: Increase the event emitter limit
276275
command: |
@@ -289,8 +288,7 @@ jobs:
289288
node ./publish-version.mjs
290289
- run:
291290
name: Again set the NPM registry (was deleted in the version script)
292-
command:
293-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
291+
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
294292
- run:
295293
name: publish package dist
296294
command: |
@@ -337,8 +335,7 @@ jobs:
337335
- setup_remote_docker:
338336
docker_layer_caching: false
339337
- run:
340-
name:
341-
Build and push Docker image from the master branch (beta releases)
338+
name: Build and push Docker image from the master branch (beta releases)
342339
command: |
343340
echo $(ls -l)
344341
@@ -417,8 +414,8 @@ workflows:
417414
store_artifacts: false
418415
working_directory: platform/app
419416
build:
420-
yarn test:data && npx cross-env QUICK_BUILD=true
421-
APP_CONFIG=config/dicomweb-server.js yarn run build
417+
yarn test:data && npx cross-env QUICK_BUILD=true APP_CONFIG=config/dicomweb-server.js
418+
yarn run build
422419
# start server --> verify running --> percy + chrome + cypress
423420
command: yarn run test:e2e:dist
424421
cache-key: 'yarn-packages-{{ checksum "yarn.lock" }}'

.eslintrc.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"plugins": [
3-
"@typescript-eslint",
4-
"import",
5-
"eslint-plugin-tsdoc",
6-
"prettier"
7-
],
2+
"plugins": ["@typescript-eslint", "import", "eslint-plugin-tsdoc", "prettier"],
83
"extends": [
94
"react-app",
105
"eslint:recommended",

.github/ISSUE_TEMPLATE/bug-report.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ body:
3939
attributes:
4040
label: The current behavior
4141
description:
42-
'A clear and concise description of what happens instead of the expected
43-
behavior.'
42+
'A clear and concise description of what happens instead of the expected behavior.'
4443
validations:
4544
required: true
4645

4746
- type: textarea
4847
id: expected_behavior
4948
attributes:
5049
label: The expected behavior
51-
description:
52-
'A clear and concise description of what you expected to happen.'
50+
description: 'A clear and concise description of what you expected to happen.'
5351
validations:
5452
required: true
5553

@@ -81,6 +79,6 @@ body:
8179
- type: markdown
8280
attributes:
8381
value: >
84-
> :warning: Reports we cannot reproduce are at risk of being marked
85-
stale and > closed. The more information you can provide, the more
86-
likely we are to look > into and address your issue.
82+
> :warning: Reports we cannot reproduce are at risk of being marked stale and > closed. The
83+
more information you can provide, the more likely we are to look > into and address your
84+
issue.

.github/ISSUE_TEMPLATE/feature-request.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@ body:
2020
attributes:
2121
label: 'What feature or change would you like to see made?'
2222
description:
23-
'Please include as much detail as possible including possibly mock up
24-
screen shots, workflow or logic flow diagrams etc.'
23+
'Please include as much detail as possible including possibly mock up screen shots, workflow
24+
or logic flow diagrams etc.'
2525
placeholder: '...'
2626
validations:
2727
required: true
2828
- type: textarea
2929
attributes:
3030
label: 'Why should we prioritize this feature?'
31-
description:
32-
'Discuss if and how the requested feature interacts with existing
33-
features.'
31+
description: 'Discuss if and how the requested feature interacts with existing features.'
3432
placeholder: '...'
3533
validations:
3634
required: true

.github/stale.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ exemptLabels:
1919
staleLabel: 'Stale :baguette_bread:'
2020
# Comment to post when marking an issue as stale. Set to `false` to disable
2121
markComment: >
22-
This issue has been automatically marked as stale because it has not had
23-
recent activity. It will be closed if no further activity occurs. Thank you
24-
for your contributions.
22+
This issue has been automatically marked as stale because it has not had recent activity. It will
23+
be closed if no further activity occurs. Thank you for your contributions.
2524
# Comment to post when closing a stale issue. Set to `false` to disable
2625
closeComment: false

.netlify/www/index.html

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
<html>
2+
<head>
3+
<title>OHIF Viewer: Deploy Preview</title>
4+
</head>
25

3-
<head>
4-
<title>OHIF Viewer: Deploy Preview</title>
5-
</head>
6-
7-
<body>
8-
<h1>Index of Previews</h1>
9-
10-
<ul>
11-
<li>
12-
<a href="/pwa">OHIF Viewer</a>
13-
</li>
14-
<li>
15-
<a href="/docs">Documentation</a>
16-
</li>
17-
<li>
18-
<a href="/ui">UI: Component Library</a>
19-
</li>
20-
</ul>
21-
</body>
6+
<body>
7+
<h1>Index of Previews</h1>
228

9+
<ul>
10+
<li>
11+
<a href="/pwa">OHIF Viewer</a>
12+
</li>
13+
<li>
14+
<a href="/docs">Documentation</a>
15+
</li>
16+
<li>
17+
<a href="/ui">UI: Component Library</a>
18+
</li>
19+
</ul>
20+
</body>
2321
</html>

.prettierrc

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
2+
"plugins": ["prettier-plugin-tailwindcss"],
23
"trailingComma": "es5",
3-
"printWidth": 80,
4+
"printWidth": 100,
45
"proseWrap": "always",
56
"tabWidth": 2,
67
"semi": true,
78
"singleQuote": true,
8-
"arrowParens": "avoid"
9+
"arrowParens": "avoid",
10+
"singleAttributePerLine": true
911
}

.webpack/helpers/excludeNodeModulesExcept.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ function excludeNodeModulesExcept(modules) {
55
if (pathSep == '\\')
66
// must be quoted for use in a regexp:
77
pathSep = '\\\\';
8-
var moduleRegExps = modules.map(function(modName) {
8+
var moduleRegExps = modules.map(function (modName) {
99
return new RegExp('node_modules' + pathSep + modName);
1010
});
1111

12-
return function(modulePath) {
12+
return function (modulePath) {
1313
if (/node_modules/.test(modulePath)) {
1414
for (var i = 0; i < moduleRegExps.length; i++)
1515
if (moduleRegExps[i].test(modulePath)) return false;

.webpack/rules/cssToJavaScript.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const autoprefixer = require('autoprefixer');
22
const path = require('path');
33
const tailwindcss = require('tailwindcss');
4-
const tailwindConfigPath = path.resolve(
5-
'../../platform/app/tailwind.config.js'
6-
);
4+
const tailwindConfigPath = path.resolve('../../platform/app/tailwind.config.js');
75
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
86
const devMode = process.env.NODE_ENV !== 'production';
97

.webpack/webpack.base.js

+8-20
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ const fs = require('fs');
77
const webpack = require('webpack');
88

99
// ~~ PLUGINS
10-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
11-
.BundleAnalyzerPlugin;
10+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
1211
const TerserJSPlugin = require('terser-webpack-plugin');
1312

1413
// ~~ PackageJSON
@@ -26,11 +25,9 @@ const QUICK_BUILD = process.env.QUICK_BUILD;
2625
const BUILD_NUM = process.env.CIRCLE_BUILD_NUM || '0';
2726

2827
// read from ../version.txt
29-
const VERSION_NUMBER =
30-
fs.readFileSync(path.join(__dirname, '../version.txt'), 'utf8') || '';
28+
const VERSION_NUMBER = fs.readFileSync(path.join(__dirname, '../version.txt'), 'utf8') || '';
3129

32-
const COMMIT_HASH =
33-
fs.readFileSync(path.join(__dirname, '../commit.txt'), 'utf8') || '';
30+
const COMMIT_HASH = fs.readFileSync(path.join(__dirname, '../commit.txt'), 'utf8') || '';
3431

3532
//
3633
dotenv.config();
@@ -105,10 +102,7 @@ module.exports = (env, argv, { SRC_DIR, ENTRY }) => {
105102
alias: {
106103
// Viewer project
107104
'@': path.resolve(__dirname, '../platform/app/src'),
108-
'@components': path.resolve(
109-
__dirname,
110-
'../platform/app/src/components'
111-
),
105+
'@components': path.resolve(__dirname, '../platform/app/src/components'),
112106
'@hooks': path.resolve(__dirname, '../platform/app/src/hooks'),
113107
'@routes': path.resolve(__dirname, '../platform/app/src/routes'),
114108
'@state': path.resolve(__dirname, '../platform/app/src/state'),
@@ -135,7 +129,7 @@ module.exports = (env, argv, { SRC_DIR, ENTRY }) => {
135129
fs: false,
136130
path: false,
137131
zlib: false,
138-
"buffer": require.resolve("buffer")
132+
buffer: require.resolve('buffer'),
139133
},
140134
},
141135
plugins: [
@@ -150,15 +144,9 @@ module.exports = (env, argv, { SRC_DIR, ENTRY }) => {
150144
'process.env.COMMIT_HASH': JSON.stringify(COMMIT_HASH),
151145
/* i18n */
152146
'process.env.USE_LOCIZE': JSON.stringify(process.env.USE_LOCIZE || ''),
153-
'process.env.LOCIZE_PROJECTID': JSON.stringify(
154-
process.env.LOCIZE_PROJECTID || ''
155-
),
156-
'process.env.LOCIZE_API_KEY': JSON.stringify(
157-
process.env.LOCIZE_API_KEY || ''
158-
),
159-
'process.env.REACT_APP_I18N_DEBUG': JSON.stringify(
160-
process.env.REACT_APP_I18N_DEBUG || ''
161-
),
147+
'process.env.LOCIZE_PROJECTID': JSON.stringify(process.env.LOCIZE_PROJECTID || ''),
148+
'process.env.LOCIZE_API_KEY': JSON.stringify(process.env.LOCIZE_API_KEY || ''),
149+
'process.env.REACT_APP_I18N_DEBUG': JSON.stringify(process.env.REACT_APP_I18N_DEBUG || ''),
162150
}),
163151
new webpack.ProvidePlugin({
164152
Buffer: ['buffer', 'Buffer'],

babel.config.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ const { extendDefaultPlugins } = require('svgo');
33

44
module.exports = {
55
babelrcRoots: ['./platform/*', './extensions/*', './modes/*'],
6-
presets: [
7-
'@babel/preset-env',
8-
'@babel/preset-react',
9-
'@babel/preset-typescript',
10-
],
6+
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
117
plugins: [
128
[
139
'inline-react-svg',

extensions/_example/src/index.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ const getCommandsModule = () => ({
5454
const ExampleContext = React.createContext();
5555

5656
function ExampleContextProvider({ children }) {
57-
return (
58-
<ExampleContext.Provider value={{ example: 'value' }}>
59-
{children}
60-
</ExampleContext.Provider>
61-
);
57+
return <ExampleContext.Provider value={{ example: 'value' }}>{children}</ExampleContext.Provider>;
6258
}
6359

6460
const getContextModule = () => [

extensions/cornerstone-dicom-rt/.webpack/webpack.prod.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ const { merge } = require('webpack-merge');
33
const path = require('path');
44
const webpackCommon = require('./../../../.webpack/webpack.base.js');
55
const pkg = require('./../package.json');
6-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
7-
.BundleAnalyzerPlugin;
6+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
87

98
const ROOT_DIR = path.join(__dirname, './..');
109
const SRC_DIR = path.join(__dirname, '../src');
@@ -38,13 +37,7 @@ module.exports = (env, argv) => {
3837
libraryTarget: 'umd',
3938
filename: pkg.main,
4039
},
41-
externals: [
42-
/\b(vtk.js)/,
43-
/\b(dcmjs)/,
44-
/\b(gl-matrix)/,
45-
/^@ohif/,
46-
/^@cornerstonejs/,
47-
],
40+
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
4841
plugins: [
4942
new webpack.optimize.LimitChunkCountPlugin({
5043
maxChunks: 1,

extensions/cornerstone-dicom-rt/babel.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
modules: 'commonjs',
1111
debug: false,
1212
},
13-
"@babel/preset-typescript",
13+
'@babel/preset-typescript',
1414
],
1515
'@babel/preset-react',
1616
],
@@ -26,7 +26,7 @@ module.exports = {
2626
// WebPack handles ES6 --> Target Syntax
2727
['@babel/preset-env', { modules: false }],
2828
'@babel/preset-react',
29-
"@babel/preset-typescript",
29+
'@babel/preset-typescript',
3030
],
3131
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
3232
},
@@ -35,7 +35,7 @@ module.exports = {
3535
// WebPack handles ES6 --> Target Syntax
3636
['@babel/preset-env', { modules: false }],
3737
'@babel/preset-react',
38-
"@babel/preset-typescript",
38+
'@babel/preset-typescript',
3939
],
4040
plugins: ['react-hot-loader/babel'],
4141
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],

0 commit comments

Comments
 (0)