setup prettier and eslint (changelog ignore)

This commit is contained in:
garronej 2021-10-11 21:09:05 +02:00
parent c4ba470dc4
commit 9f8218efb7
7 changed files with 1393 additions and 60 deletions

7
.eslintignore Normal file
View File

@ -0,0 +1,7 @@
node_modules/
dist/
CHANGELOG.md
.yarn_home/
src/test/apps/
src/test/types/
src/tools/types/

16
.eslintrc.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
"rules": {
"no-extra-boolean-cast": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
},
};

View File

@ -9,8 +9,25 @@ on:
jobs:
test_lint:
runs-on: ubuntu-latest
if: ${{ !github.event.created && github.repository != 'garronej/ts_ci' }}
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.3
- uses: bahmutov/npm-install@v1
- name: If this step fails run 'npm run lint' and 'npm run format' then commit again.
run: |
PACKAGE_MANAGER=npm
if [ -f "./yarn.lock" ]; then
PACKAGE_MANAGER=yarn
fi
$PACKAGE_MANAGER run lint:check
$PACKAGE_MANAGER run format:check
test:
runs-on: macos-10.15
needs: test_lint
strategy:
matrix:
node: [ '15', '14', '13' ]

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
node_modules/
/dist/
/CHANGELOG.md
/.yarn_home/
/src/test/apps/
/src/tools/types/

11
.prettierrc.json Normal file
View File

@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"quoteProps": "preserve",
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "avoid"
}

View File

@ -15,12 +15,31 @@
"test": "node dist/test/bin/main && node dist/test/lib",
"copy-files": "copyfiles -u 1 src/**/*.ftl src/**/*.xml src/**/*.js dist/",
"generate-messages": "node dist/bin/generate-i18n-messages.js",
"link_in_test_app": "node dist/bin/link_in_test_app.js"
"link_in_test_app": "node dist/bin/link_in_test_app.js",
"lint:check": "eslint . --ext .ts,.tsx",
"lint": "yarn lint:check --fix",
"_format": "prettier '**/*.{ts,tsx,json,md}'",
"format": "yarn _format --write",
"format:check": "yarn _format --list-different",
"yarn_link": "ts-node src/bin/yarn_link.ts"
},
"bin": {
"build-keycloak-theme": "dist/bin/build-keycloak-theme/index.js",
"download-builtin-keycloak-theme": "dist/bin/download-builtin-keycloak-theme.js"
},
"lint-staged": {
"*.{ts,tsx}": [
"eslint --fix"
],
"*.{ts,tsx,json,md}": [
"prettier --write"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged -v"
}
},
"author": "u/garronej",
"license": "MIT",
"files": [
@ -48,7 +67,13 @@
"properties-parser": "^0.3.1",
"react": "^17.0.1",
"rimraf": "^3.0.2",
"typescript": "^4.2.3"
"typescript": "^4.2.3",
"@typescript-eslint/eslint-plugin": "^4.24.0",
"@typescript-eslint/parser": "^4.24.0",
"eslint": "^7.26.0",
"eslint-config-prettier": "^8.3.0",
"husky": "^4.3.8",
"lint-staged": "^11.0.0"
},
"dependencies": {
"@emotion/react": "^11.4.1",

1367
yarn.lock

File diff suppressed because it is too large Load Diff