-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Format .js, .css, and .java files with formatter. * Format .js, .css, and .java files with formatter. * Format files from merge. * Set up linter * Fix linting errors * Update README on running the formatter * Set up linter * Update README on running the formatter
- Loading branch information
1 parent
647e61f
commit 0cf2ec5
Showing
6 changed files
with
1,775 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": ["react-app", "eslint:recommended"], | ||
"rules": { | ||
"no-multi-spaces": "off", | ||
"require-jsdoc": "off", | ||
"valid-jsdoc": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install node dependencies | ||
if: always() | ||
run: make node_modules | ||
- name: Check CSS Formatting | ||
if: always() | ||
run: node_modules/prettier/bin-prettier.js -c frontend/src/*.css | ||
- name: Validate JavaScript | ||
if: always() | ||
run: node_modules/eslint/bin/eslint.js frontend/src/*.js | ||
- name: Check JavaScript Formatting | ||
if: always() | ||
run: node_modules/prettier/bin-prettier.js -c frontend/src/*.js | ||
- name: Check Java Formatting | ||
if: always() | ||
run: diff -u <(cat portfolio/src/main/java/com/google/sps/servlets/*.java) <(node_modules/clang-format/bin/linux_x64/clang-format --style=Google portfolio/src/main/java/com/google/sps/servlets/*.java) | ||
- name: Notify on failure | ||
if: failure() | ||
run: echo 'run "make validate" and "make pretty" to see/fix errors locally' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 88, | ||
"overrides": [ | ||
{ | ||
"files": ["*.css"], | ||
"options": { | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"useTabs": false | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Set the path to clang-format according to OS | ||
CLANG_FORMAT := | ||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Linux) | ||
CLANG_FORMAT += node_modules/clang-format/bin/linux_x64/clang-format --style=Google | ||
else | ||
CLANG_FORMAT += node_modules/clang-format/bin/darwin_x64/clang-format --style=Google | ||
endif | ||
|
||
ESLINT=node_modules/eslint/bin/eslint.js | ||
PRETTIER=node_modules/prettier/bin-prettier.js | ||
|
||
node_modules: | ||
npm install clang-format prettier eslint [email protected] eslint-config-react-app babel-eslint eslint-plugin-import eslint-plugin-flowtype eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks | ||
|
||
pretty: node_modules | ||
$(PRETTIER) --write frontend/src/*.css | ||
$(PRETTIER) --write frontend/src/*.js | ||
find backend/src/main -iname *.java | xargs $(CLANG_FORMAT) -i | ||
|
||
validate: node_modules | ||
$(ESLINT) frontend/src/*.js |
Oops, something went wrong.