Skip to content
Snippets Groups Projects
Commit f3215d7c authored by Camille Simiand's avatar Camille Simiand
Browse files

To display javascrips, from memorekall-member container run:

- "npm install && npm run lint"

Update instructions to run the ESLint script and add it to the
pre-commit hook.
parent 80084d72
No related branches found
No related tags found
1 merge request!12Add ESLint dependency
{
"root": true,
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module",
"parser": "babel-eslint"
},
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended"
]
}
...@@ -3,15 +3,16 @@ This project has been created to help artists document their creative process wi ...@@ -3,15 +3,16 @@ This project has been created to help artists document their creative process wi
## Contributors ## Contributors
The Tetras Libre team follows some code quality requirements. The Tetras Libre team follows some code quality requirements.
Indeed, to ensure the respect of the standards PHP rules, we use a pre-commit hook as a safety net before sending any contribution. Indeed, to ensure the respect of the standards PHP and JavaScript rules, we use a pre-commit hook as a safety net before sending any contribution.
The following quality tool scripts will be triggered before reaching commit message editor. The following quality tool scripts will be triggered before reaching commit message editor.
- **PHPUnit** (functional and unit tests) - **PHPUnit** (functional and unit tests)
- **PHP_CodeSniffer** (for PSR standards) - **PHP_CodeSniffer** (for PSR standards)
- **PHPSTAN** (for static analysis) - **PHPSTAN** (for static analysis)
- **ESLint** (JavaScript linter)
*** ***
### How to run the code quality scripts? ### How to run the code quality scripts?
First, you need to enter the memorekall-member docker container: `docker-compose exec memorekall-member bash` First, you need to enter the memorekall-member docker container: `docker-compose exec memorekall-member bash`
- To run the script independently of a commit: `composer {phpcs/phpstan/tests}` - To run the script independently of a commit: `composer {phpcs/phpstan/tests}` or `npm install` and `npm run lint` for ESLint
- To fix PHP_CodeSniffer errors: `composer phpcbf` - To fix PHP_CodeSniffer errors: `composer phpcbf`
- To run them all: `composer ci` - To run them all: `composer ci`
......
This diff is collapsed.
{ {
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.16.3",
"@popperjs/core": "^2.10.2", "@popperjs/core": "^2.10.2",
"@symfony/stimulus-bridge": "^2.0.0", "@symfony/stimulus-bridge": "^2.0.0",
"@symfony/webpack-encore": "^1.0.0", "@symfony/webpack-encore": "^1.0.0",
"bootstrap": "^5.1.3", "bootstrap": "^5.1.3",
"core-js": "^3.0.0", "core-js": "^3.0.0",
"eslint": "^8.3.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"regenerator-runtime": "^0.13.2", "regenerator-runtime": "^0.13.2",
"sass-loader": "^12.3.0", "sass-loader": "^12.3.0",
"stimulus": "^2.0.0", "stimulus": "^2.0.0",
"webpack-notifier": "^1.6.0" "webpack-notifier": "^1.6.0",
"yorkie": "^2.0.0"
}, },
"license": "UNLICENSED", "license": "UNLICENSED",
"private": true, "private": true,
...@@ -19,7 +23,8 @@ ...@@ -19,7 +23,8 @@
"dev-server": "encore dev-server", "dev-server": "encore dev-server",
"dev": "encore dev", "dev": "encore dev",
"watch": "encore dev --watch", "watch": "encore dev --watch",
"build": "encore production --progress" "build": "encore production --progress",
"lint": "eslint --max-warnings=0 ."
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^10.4.0", "autoprefixer": "^10.4.0",
......
...@@ -32,3 +32,13 @@ else ...@@ -32,3 +32,13 @@ else
echo -e "\n ${GREENBOLD} Your code passed static analysis successfully! \n echo -e "\n ${GREENBOLD} Your code passed static analysis successfully! \n
\n Committing your changes now... \n ${NORMAL}" \n Committing your changes now... \n ${NORMAL}"
fi fi
echo -e "\n ${BOLD} Starting ESLint... \n ${NORMAL}"
npm run lint
if [ $? != 0 ]; then
echo -e "\n ${REDBOLD} ESLint verification failed \n ${NORMAL}"
exit 1;
else
echo -e "\n ${GREENBOLD} Your code passed JS linter successfully! \n
\n Committing your changes now... \n ${NORMAL}"
fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment