Skip to content

Instantly share code, notes, and snippets.

@igorparrabastias
Last active September 21, 2022 21:34
Show Gist options
  • Save igorparrabastias/c7cc59ff5c61fd8c89bb7ada7680e8d1 to your computer and use it in GitHub Desktop.
Save igorparrabastias/c7cc59ff5c61fd8c89bb7ada7680e8d1 to your computer and use it in GitHub Desktop.

Revisions

  1. Igor Parra Bastias revised this gist Sep 21, 2022. 1 changed file with 15 additions and 8 deletions.
    23 changes: 15 additions & 8 deletions Initialization project in javascript.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,20 @@
    # Using eslint for projects

    ## Init project
    ```
    npm init
    ```

    ## Add basics packages
    yarn add eslint jest nodemon -D
    ```
    npm install eslint jest nodemon --save-dev
    ```

    ## Init eslint

    ## Install eslint globally
    npm install eslint -g
    Create .eslintrc.js for commonjs (useful for generic backend modules) and standard code style

    ## 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
    @@ -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

    ## Adding Code Actions on Save (vscode)
    ## 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 --global
    npm install standard eslint --global
    ```

    2) Install vscode standardjs extension
  2. Igor Parra Bastias revised this gist Sep 21, 2022. 1 changed file with 27 additions and 1 deletion.
    28 changes: 27 additions & 1 deletion Initialization project in javascript.md
    Original 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
    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
    ```



  3. Igor Parra Bastias revised this gist Aug 20, 2022. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion Initialization project in javascript.md
    Original 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
    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
  4. Igor Parra Bastias revised this gist Aug 20, 2022. 1 changed file with 20 additions and 20 deletions.
    40 changes: 20 additions & 20 deletions Initialization project in javascript.md
    Original 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
    ...
    $ 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
  5. Igor Parra Bastias revised this gist Aug 20, 2022. No changes.
  6. Igor Parra Bastias renamed this gist Aug 20, 2022. 1 changed file with 0 additions and 0 deletions.
  7. Igor Parra Bastias created this gist Aug 20, 2022.
    31 changes: 31 additions & 0 deletions Initialization project in javascript
    Original 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