Enable prettier

This commit is contained in:
Tim Jacomb 2022-08-02 22:49:25 +01:00 committed by Tim Jacomb
parent 6b0dc184bf
commit 16f0d3bd33
No known key found for this signature in database
GPG Key ID: D40F4AD2F55AF15F
6 changed files with 71 additions and 8 deletions

4
.prettierrc.json Normal file
View File

@ -0,0 +1,4 @@
{
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "ignore"
}

View File

@ -5,7 +5,7 @@ module.exports = {
es2022: true
},
// Uses eslint default ruleset
extends: "eslint:recommended",
extends: ["eslint:recommended", "prettier"],
parserOptions: {
sourceType: "module"
},

34
war/.prettierignore Normal file
View File

@ -0,0 +1,34 @@
# generated / build files
.pnp.cjs
.pnp.loader.mjs
target/
work/
node/
.yarnrc.yml
# libraries / external deps / generated files
src/main/js/plugin-setup-wizard/bootstrap-detached.js
src/main/webapp/scripts/behavior.js
src/main/webapp/bootstrap
src/main/webapp/scripts/yui
src/main/webapp/scripts/prototype.js
src/main/fonts/font-awesome
src/main/webapp/css/font-awesome
src/main/fonts/google-fonts/roboto/css/roboto.css
src/main/webapp/css/google-fonts/roboto/css/roboto.css
src/main/fonts/icomoon/css/icomoon.css
src/main/webapp/css/icomoon/css/icomoon.css
src/main/webapp/jsbundles/
# test files that we don't need formatted
../test/src/test/resources
../test/jmh-report.json
# doesn't work, see https://github.com/prettier/prettier/issues/5340
*.hbs
.yarn
# TODO not sure why this fails
src/main/less/abstracts/theme.less

View File

@ -14,12 +14,12 @@
"prod": "webpack --config webpack.config.js --mode=production",
"build": "yarn prod",
"start": "yarn dev --watch",
"lint:js": "eslint . --ext js",
"lint:js-ci": "eslint . --ext js -f checkstyle -o target/eslint-warnings.xml",
"lint:js": "eslint . --ext js && prettier --check ../",
"lint:js-ci": "eslint . --ext js -f checkstyle -o target/eslint-warnings.xml && prettier --check ../",
"lint:css": "stylelint src/main/less",
"lint:css-ci": "stylelint src/main/less --custom-formatter stylelint-formatter.js -o target/stylelint-warnings.xml",
"lint:css:fix": "stylelint src/main/less --fix",
"lint:ci": "yarn lint:js-ci && yarn lint:css-ci",
"lint:fix": "prettier --write ../ && stylelint src/main/less --fix",
"lint": "yarn lint:js && yarn lint:css"
},
"devDependencies": {
@ -31,6 +31,7 @@
"css-loader": "6.7.1",
"css-minimizer-webpack-plugin": "4.0.0",
"eslint": "8.22.0",
"eslint-config-prettier": "8.5.0",
"handlebars": "4.7.7",
"handlebars-loader": "1.7.2",
"less": "4.1.3",
@ -38,6 +39,7 @@
"mini-css-extract-plugin": "2.6.1",
"postcss": "8.4.16",
"postcss-loader": "7.0.1",
"prettier": "2.7.1",
"style-loader": "3.3.1",
"stylelint": "14.11.0",
"stylelint-config-standard": "28.0.0",

View File

@ -1,13 +1,14 @@
/* eslint-env node */
const reporter = require('stylelint-checkstyle-reporter')
// TODO remove this file once https://github.com/stylelint/stylelint/issues/6100 is released
const reporter = require("stylelint-checkstyle-reporter");
/**
* @type {import('stylelint').Formatter}
* @type {import("stylelint").Formatter}
*/
function formatter(results, returnValue) {
returnValue.output = reporter(results)
returnValue.output = reporter(results);
return returnValue.output
return returnValue.output;
}
module.exports = formatter;

View File

@ -3061,6 +3061,17 @@ __metadata:
languageName: node
linkType: hard
"eslint-config-prettier@npm:8.5.0":
version: 8.5.0
resolution: "eslint-config-prettier@npm:8.5.0"
peerDependencies:
eslint: ">=7.0.0"
bin:
eslint-config-prettier: bin/cli.js
checksum: 0d0f5c32e7a0ad91249467ce71ca92394ccd343178277d318baf32063b79ea90216f4c81d1065d60f96366fdc60f151d4d68ae7811a58bd37228b84c2083f893
languageName: node
linkType: hard
"eslint-scope@npm:5.1.1":
version: 5.1.1
resolution: "eslint-scope@npm:5.1.1"
@ -4027,6 +4038,7 @@ __metadata:
css-loader: 6.7.1
css-minimizer-webpack-plugin: 4.0.0
eslint: 8.22.0
eslint-config-prettier: 8.5.0
handlebars: 4.7.7
handlebars-loader: 1.7.2
hotkeys-js: 3.9.5
@ -4039,6 +4051,7 @@ __metadata:
postcss: 8.4.16
postcss-less: 6.0.0
postcss-loader: 7.0.1
prettier: 2.7.1
sortablejs: 1.15.0
style-loader: 3.3.1
stylelint: 14.11.0
@ -5466,6 +5479,15 @@ __metadata:
languageName: node
linkType: hard
"prettier@npm:2.7.1":
version: 2.7.1
resolution: "prettier@npm:2.7.1"
bin:
prettier: bin-prettier.js
checksum: 55a4409182260866ab31284d929b3cb961e5fdb91fe0d2e099dac92eaecec890f36e524b4c19e6ceae839c99c6d7195817579cdffc8e2c80da0cb794463a748b
languageName: node
linkType: hard
"promise-inflight@npm:^1.0.1":
version: 1.0.1
resolution: "promise-inflight@npm:1.0.1"