Last active
September 21, 2022 21:34
-
-
Save igorparrabastias/c7cc59ff5c61fd8c89bb7ada7680e8d1 to your computer and use it in GitHub Desktop.
Revisions
-
Igor Parra Bastias revised this gist
Sep 21, 2022 . 1 changed file with 15 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,20 @@ # Using eslint for projects ## Init project ``` npm init ``` ## Add basics packages ``` npm install eslint jest nodemon --save-dev ``` ## Init eslint Create .eslintrc.js for commonjs (useful for generic backend modules) and standard code style ``` $ eslint --init You can also run this command directly using 'npm init @eslint/config'. npx: installed 40 in 1.055s @@ -29,14 +36,14 @@ eslint-config-standard@latest eslint@^8.0.1 eslint-plugin-import@^2.25.2 eslint- Installing eslint-config-standard@latest, eslint@^8.0.1, eslint-plugin-import@^2.25.2, eslint-plugin-n@^15.0.0, eslint-plugin-promise@^6.0.0 ... Successfully created .eslintrc.js file in /media/nomikos/home/nomikos2/dev/pruebas-trabajo/amazon-sde/plusMinus ``` ref: https://dev.to/devdammak/setting-up-eslint-in-your-javascript-project-with-vs-code-2amf ## Allowing formatting on save (vscode) In settings.json paste the following code: ``` .vscode/settings.json { "editor.codeActionsOnSave": { @@ -57,7 +64,7 @@ In many occasions you just want edit some single js files without all the paraph 1) Install standard globally ``` npm install standard eslint --global ``` 2) Install vscode standardjs extension -
Igor Parra Bastias revised this gist
Sep 21, 2022 . 1 changed file with 27 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,4 +46,30 @@ In settings.json paste the following code: } ``` ref: https://www.digitalocean.com/community/tutorials/workflow-auto-eslinting --- # Using eslint standard style in vscode without package.json In many occasions you just want edit some single js files without all the paraphernalia 1) Install standard globally ``` npm install standard --global ``` 2) Install vscode standardjs extension https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard 3) Customize vscode-standard in your VSCode settings.json. ``` standard.enable: true standard.enableGlobally: true standard.autoFixOnSave: true ``` -
Igor Parra Bastias revised this gist
Aug 20, 2022 . 1 changed file with 19 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,4 +28,22 @@ eslint-config-standard@latest eslint@^8.0.1 eslint-plugin-import@^2.25.2 eslint- ✔ Which package manager do you want to use? · yarn Installing eslint-config-standard@latest, eslint@^8.0.1, eslint-plugin-import@^2.25.2, eslint-plugin-n@^15.0.0, eslint-plugin-promise@^6.0.0 ... Successfully created .eslintrc.js file in /media/nomikos/home/nomikos2/dev/pruebas-trabajo/amazon-sde/plusMinus ref: https://dev.to/devdammak/setting-up-eslint-in-your-javascript-project-with-vs-code-2amf ## Adding Code Actions on Save (vscode) ``` In settings.json paste the following code: .vscode/settings.json { "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "eslint.validate": ["javascript"] } ``` ref: https://www.digitalocean.com/community/tutorials/workflow-auto-eslinting -
Igor Parra Bastias revised this gist
Aug 20, 2022 . 1 changed file with 20 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,24 +8,24 @@ yarn add eslint jest nodemon -D npm install eslint -g ## Init eslint creating .eslintrc.js for node.js, commonjs (useful for generic modules) ans standard code style $ eslint --init You can also run this command directly using 'npm init @eslint/config'. npx: installed 40 in 1.055s ✔ How would you like to use ESLint? · style ✔ What type of modules does your project use? · commonjs ✔ Which framework does your project use? · none ✔ Does your project use TypeScript? · No / Yes ✔ Where does your code run? · node ✔ How would you like to define a style for your project? · guide ✔ Which style guide do you want to follow? · standard ✔ What format do you want your config file to be in? · JavaScript Checking peerDependencies of eslint-config-standard@latest The config that you've selected requires the following dependencies: eslint-config-standard@latest eslint@^8.0.1 eslint-plugin-import@^2.25.2 eslint-plugin-n@^15.0.0 eslint-plugin-promise@^6.0.0 ✔ Would you like to install them now? · No / Yes ✔ Which package manager do you want to use? · yarn Installing eslint-config-standard@latest, eslint@^8.0.1, eslint-plugin-import@^2.25.2, eslint-plugin-n@^15.0.0, eslint-plugin-promise@^6.0.0 ... Successfully created .eslintrc.js file in /media/nomikos/home/nomikos2/dev/pruebas-trabajo/amazon-sde/plusMinus -
Igor Parra Bastias revised this gist
Aug 20, 2022 . No changes.There are no files selected for viewing
-
Igor Parra Bastias renamed this gist
Aug 20, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Igor Parra Bastias created this gist
Aug 20, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ ## Init project npm init ## Add basics packages yarn add eslint jest nodemon -D ## Install eslint globally npm install eslint -g ## Init eslint creating .eslintrc.js for node.js, commonjs (useful for generic modules) ans standard code style $ eslint --init You can also run this command directly using 'npm init @eslint/config'. npx: installed 40 in 1.055s ✔ How would you like to use ESLint? · style ✔ What type of modules does your project use? · commonjs ✔ Which framework does your project use? · none ✔ Does your project use TypeScript? · No / Yes ✔ Where does your code run? · node ✔ How would you like to define a style for your project? · guide ✔ Which style guide do you want to follow? · standard ✔ What format do you want your config file to be in? · JavaScript Checking peerDependencies of eslint-config-standard@latest The config that you've selected requires the following dependencies: eslint-config-standard@latest eslint@^8.0.1 eslint-plugin-import@^2.25.2 eslint-plugin-n@^15.0.0 eslint-plugin-promise@^6.0.0 ✔ Would you like to install them now? · No / Yes ✔ Which package manager do you want to use? · yarn Installing eslint-config-standard@latest, eslint@^8.0.1, eslint-plugin-import@^2.25.2, eslint-plugin-n@^15.0.0, eslint-plugin-promise@^6.0.0 ... Successfully created .eslintrc.js file in /media/nomikos/home/nomikos2/dev/pruebas-trabajo/amazon-sde/plusMinus