Skip to content

Instantly share code, notes, and snippets.

@seeliang
Last active December 2, 2024 05:08
Show Gist options
  • Save seeliang/0f0de424d1cdc4541c338f4ee93b7e6a to your computer and use it in GitHub Desktop.
Save seeliang/0f0de424d1cdc4541c338f4ee93b7e6a to your computer and use it in GitHub Desktop.

Revisions

  1. seeliang revised this gist Apr 9, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ##[Updated on medium](https://seeliang.medium.com/how-to-update-lint-without-lint-the-whole-project-841150aa59b0)
    ## [Updated on medium](https://seeliang.medium.com/how-to-update-lint-without-lint-the-whole-project-841150aa59b0)

    ## find out the differences
    use git diff to generate file list
  2. seeliang revised this gist Apr 9, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    [Updated on medium](https://seeliang.medium.com/how-to-update-lint-without-lint-the-whole-project-841150aa59b0)
    ##[Updated on medium](https://seeliang.medium.com/how-to-update-lint-without-lint-the-whole-project-841150aa59b0)

    ## find out the differences
    use git diff to generate file list
  3. seeliang revised this gist Nov 8, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    ## find out the differences
    [Updated on medium](https://seeliang.medium.com/how-to-update-lint-without-lint-the-whole-project-841150aa59b0)

    ## find out the differences
    use git diff to generate file list

    `git diff --name-only master`
  4. seeliang revised this gist Dec 1, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    `git diff --name-only master`

    ## limited to centain file tpye
    ## limited to certain file types
    add ext filter

    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`
    @@ -47,4 +47,4 @@ will need grep fallback for empty result cases
    "lint:style": "stylelint --config .stylelintrc.js $(git diff --name-only --diff-filter=ACMRTUXB origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    ```

    **NOTE: make sure our local branch is up to date (merge orgin/master)**
    **NOTE: make sure our local branch is up to date (merge origin/master)**
  5. seeliang revised this gist Dec 1, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -45,4 +45,6 @@ will need grep fallback for empty result cases
    ....
    "scripts":
    "lint:style": "stylelint --config .stylelintrc.js $(git diff --name-only --diff-filter=ACMRTUXB origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    ```
    ```

    **NOTE: make sure our local branch is up to date (merge orgin/master)**
  6. seeliang revised this gist Dec 1, 2019. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,21 @@
    ## find out the differences
    use git diff to generate file list

    `git diff --name-only master`

    ## limited to centain file tpye
    add ext filter

    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ## handle the case of file removal
    ignore deleted files

    `git diff --name-only --diff-filter=ACMRTUXB master | grep -E "(.js$|.ts$|.tsx$)"`


    ## node scripts
    add eslint to script
    add eslint to
    package.json

    ```json
    @@ -21,7 +24,9 @@
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only --diff-filter=ACMRTUXB master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```
    ## for circle ci
    ## CI script

    sample with circle ci
    [here](https://discuss.circleci.com/t/circleci-checkout-seems-to-do-shallow-checkout-clone/27458)

    ```json
  7. seeliang revised this gist Dec 1, 2019. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,18 @@
    ## use git diff to generate file list
    ## find out the differences
    use git diff to generate file list
    `git diff --name-only master`

    ## add ext filter
    ## limited to centain file tpye
    add ext filter
    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ## ignore deleted files
    ## handle the case of file removal
    ignore deleted files
    `git diff --name-only --diff-filter=ACMRTUXB master | grep -E "(.js$|.ts$|.tsx$)"`


    ## add eslint to script
    ## node scripts
    add eslint to script
    package.json

    ```json
  8. seeliang revised this gist Nov 20, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    ## add ext filter
    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ## ignore delected
    ## ignore deleted files
    `git diff --name-only --diff-filter=ACMRTUXB master | grep -E "(.js$|.ts$|.tsx$)"`


  9. seeliang revised this gist Nov 20, 2019. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -4,14 +4,18 @@
    ## add ext filter
    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ## ignore delected
    `git diff --name-only --diff-filter=ACMRTUXB master | grep -E "(.js$|.ts$|.tsx$)"`


    ## add eslint to script
    package.json

    ```json

    ....
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")"
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only --diff-filter=ACMRTUXB master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```
    ## for circle ci
    [here](https://discuss.circleci.com/t/circleci-checkout-seems-to-do-shallow-checkout-clone/27458)
    @@ -20,7 +24,7 @@

    ....
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\")"
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only --diff-filter=ACMRTUXB origin/master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```

    ## for stylelint
    @@ -31,5 +35,5 @@ will need grep fallback for empty result cases

    ....
    "scripts":
    "lint:style": "stylelint --config .stylelintrc.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    "lint:style": "stylelint --config .stylelintrc.js $(git diff --name-only --diff-filter=ACMRTUXB origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    ```
  10. seeliang revised this gist Nov 19, 2019. No changes.
  11. seeliang revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lint-only-changed-files.MD
    Original file line number Diff line number Diff line change
    @@ -31,5 +31,5 @@ will need grep fallback for empty result cases

    ....
    "scripts":
    "lint:style": "stylelint --config stylelint.config.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    "lint:style": "stylelint --config .stylelintrc.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    ```
  12. seeliang renamed this gist Nov 19, 2019. 1 changed file with 0 additions and 0 deletions.
  13. seeliang renamed this gist Nov 19, 2019. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion lint-changed-file.MD → lint-only-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    ## add ext filter
    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ## add to script
    ## add eslint to script
    package.json

    ```json
    @@ -21,4 +21,15 @@
    ....
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```

    ## for stylelint

    will need grep fallback for empty result cases

    ```json

    ....
    "scripts":
    "lint:style": "stylelint --config stylelint.config.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\" || echo \".stylelintrc.js\")"
    ```
  14. seeliang revised this gist Nov 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```
    ### circle ci
    ## for circle ci
    [here](https://discuss.circleci.com/t/circleci-checkout-seems-to-do-shallow-checkout-clone/27458)

    ```json
  15. seeliang revised this gist Nov 19, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,8 @@
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```
    ### circle ci (here)[https://discuss.circleci.com/t/circleci-checkout-seems-to-do-shallow-checkout-clone/27458]
    ### circle ci
    [here](https://discuss.circleci.com/t/circleci-checkout-seems-to-do-shallow-checkout-clone/27458)

    ```json

  16. seeliang revised this gist Nov 19, 2019. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,11 @@
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```

    ### circle ci (here)[https://discuss.circleci.com/t/circleci-checkout-seems-to-do-shallow-checkout-clone/27458]

    ```json

    ....
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only origin/master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```
  17. seeliang revised this gist Nov 18, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    ##use git diff to generate file list
    ## use git diff to generate file list
    `git diff --name-only master`

    ##add ext filter
    ## add ext filter
    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ##add to script
    ## add to script
    package.json

    ```json
  18. seeliang revised this gist Nov 18, 2019. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,10 @@
    ##use git diff to lint
    ##use git diff to generate file list
    `git diff --name-only master`

    ##add ext filter
    `git diff --name-only master | grep -E "(.js$|.ts$|.tsx$)"`

    ##add to script
    package.json

    ```json
  19. seeliang revised this gist Nov 18, 2019. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    use git diff to lint
    ##use git diff to lint

    package.json

    ```json

    ```
    // package.json
    ....
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")"
  20. seeliang revised this gist Nov 18, 2019. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,9 @@
    use git diff to lint
    `eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")`,

    ```
    // package.json
    ....
    "scripts":
    "lint:script": "eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")"
    ```

  21. seeliang created this gist Nov 18, 2019.
    2 changes: 2 additions & 0 deletions lint-changed-file.MD
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    use git diff to lint
    `eslint -c eslintrc.js $(git diff --name-only master | grep -E \"(.js$|.ts$|.tsx$)\")`,