Skip to content

Instantly share code, notes, and snippets.

@devinrhode2
Last active December 8, 2023 20:32
Show Gist options
  • Save devinrhode2/08c84e175c61b282b76f4766a94e4a01 to your computer and use it in GitHub Desktop.
Save devinrhode2/08c84e175c61b282b76f4766a94e4a01 to your computer and use it in GitHub Desktop.

Revisions

  1. devinrhode2 revised this gist Nov 22, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ module.exports = {
    printWidth: 40,
    // Less code per line:
    // - less likely to have conflict any given line
    // - easier to spot changes in git
    // - easier to spot changes in git (e.g. getListThing->getListsThing)
    // - Encourages modularity
    // - jsx components with 20 indent levels will not look good
    // - This encourages creating smaller components
  2. devinrhode2 revised this gist Nov 22, 2021. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,12 @@ module.exports = {
    // avoid even more merge conflicts: https://prettier.io/blog/2020/03/21/2.0.0.html#change-default-value-for-trailingcomma-to-es5-6963httpsgithubcomprettierprettierpull6963-by-fiskerhttpsgithubcomfisker
    trailingComma: 'all',
    printWidth: 40,
    // Makes inline-diff highlighting less relelvant.
    // - In VSCode, if you edit the last character in a line, it may be hard to see the actual change.
    // - Or if there's a one-letter typo... VSCode will highlight that one character change
    // - However, with a low printWidth, code becomes very vertical
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line
    // Less code per line:
    // - less likely to have conflict any given line
    // - easier to spot changes in git
    // - Encourages modularity
    // - jsx components with 20 indent levels will not look good
    // - This encourages creating smaller components
    // - Still can opt-out with `// prettier-ignore` comments above component
    // - OR, create a `.prettierrc.js` file in code you edit the most
    }
  3. devinrhode2 revised this gist Nov 22, 2021. 1 changed file with 0 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -14,16 +14,4 @@ module.exports = {
    // - However, with a low printWidth, code becomes very vertical
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line

    // Cannot be "consistent" - would cause thrashing in git history:
    // quoteProps: "as-needed", // Could go with "preserve" if it makes more sense in some situation

    // Avoid thrashing, assert default?
    // arrowParens: "always",

    // avoid/minimize merge conflicts:
    // bracketSameLine: false,

    // avoid XO default `false` https://github.com/xojs/xo/pull/616/files
    // bracketSpacing: true,
    }
  4. devinrhode2 revised this gist Nov 22, 2021. 1 changed file with 9 additions and 16 deletions.
    25 changes: 9 additions & 16 deletions .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -5,32 +5,25 @@ module.exports = {
    singleQuote: true,
    semi: false,

    // avoid even more merge conflicts: https://prettier.io/blog/2020/03/21/2.0.0.html#change-default-value-for-trailingcomma-to-es5-6963httpsgithubcomprettierprettierpull6963-by-fiskerhttpsgithubcomfisker
    trailingComma: 'all',
    printWidth: 40,
    // determined here:
    // commit 27987c4b47834a1fff9402b729d3a39d7539b6f9
    // Author: Rhode, Devin <[email protected]>
    // Date: Wed Oct 27 16:29:49 2021 -0500
    //
    // wip redirect manager
    //
    // It also makes inline-diff highlighting less relelvant.
    // Makes inline-diff highlighting less relelvant.
    // - In VSCode, if you edit the last character in a line, it may be hard to see the actual change.
    // - Or if there's a one-letter typo... VSCode will highlight that one character change
    // - However, with a low printWidth, code becomes very vertical
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line

    // avoid merge conflicts:
    trailingComma: 'all',
    bracketSameLine: false,
    jsxBracketSameLine: false, // deprecated in 2.4

    // Cannot be "consistent" - would cause thrashing in git history:
    quoteProps: "as-needed", // Could go with "preserve" if it makes more sense in some situation
    // quoteProps: "as-needed", // Could go with "preserve" if it makes more sense in some situation

    // Avoid thrashing, assert default?
    arrowParens: "always",
    // arrowParens: "always",

    // avoid/minimize merge conflicts:
    // bracketSameLine: false,

    // avoid XO default `false` https://github.com/xojs/xo/pull/616/files
    bracketSpacing: true,
    // bracketSpacing: true,
    }
  5. devinrhode2 revised this gist Nov 22, 2021. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,8 @@

    /** @type {import('prettier').RequiredOptions} */
    module.exports = {
    // Devins personal preferences:
    singleQuote: true, // Also avoids extra finger movement:
    semi: false, // less visual clutter
    singleQuote: true,
    semi: false,

    printWidth: 40,
    // determined here:
    @@ -21,13 +20,11 @@ module.exports = {
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line

    // Required:
    // avoid merge conflicts:
    trailingComma: 'all',
    bracketSameLine: false,
    jsxBracketSameLine: false, // deprecated in 2.4

    // Required:
    trailingComma: 'all',

    // Cannot be "consistent" - would cause thrashing in git history:
    quoteProps: "as-needed", // Could go with "preserve" if it makes more sense in some situation

  6. devinrhode2 revised this gist Nov 21, 2021. 2 changed files with 56 additions and 52 deletions.
    88 changes: 36 additions & 52 deletions .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -1,55 +1,39 @@
    /*
    These prettier config settings are intended to reduce merge conflicts as much as possible.
    My original google searches:
    what prettier options are best for git diffs
    what prettier options are best for git diffs avoid merge conflicts
    what prettier options are best for git diffs avoid merge conflicts "trailingComma"
    prettier lowest printWidth
    Something I would like, is an eslint config that is _very similar_ to prettier, but does has less deterministic formatting
    - I sense starting with Standard.js or XO eslint style config would be a good starting point.
    I'm curious what doing a format with printWidth: 1, and then doing a normal format would be like.
    Sometimes prettier will make things more vertical, but not make them more horizontal.
    Obviously more vertical is best for reducing merge conflicts.
    */
    // Prettier config to reduce merge conflicts: https://gist.github.com/devinrhode2/08c84e175c61b282b76f4766a94e4a01

    /** @type {import('prettier').RequiredOptions} */
    module.exports = {
    printWidth: 40,
    // determined here:
    // commit 27987c4b47834a1fff9402b729d3a39d7539b6f9 (origin/chore-dgr-dropping-xo-fix-all-script, chore-dgr-dropping-xo-fix-all-script)
    // Author: Rhode, Devin <[email protected]>
    // Date: Wed Oct 27 16:29:49 2021 -0500
    //
    // wip redirect manager
    //
    // It also makes inline-diff highlighting less relelvant.
    // - In VSCode, if you edit the last character in a line, it may be hard to see the actual change.
    // - Or if there's a one-letter typo... VSCode will highlight that one character change
    // - However, with a low printWidth, code becomes very vertical
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line


    // Required:
    bracketSameLine: false,
    jsxBracketSameLine: false // deprecated in 2.4

    // Required:
    trailingComma: 'all'

    // Cannot be "consistent" - would cause thrashing in git history:
    quoteProps: "as-needed" // Could go with "preserve" if it makes more sense in some situation

    // Devins personal preference:
    // Also avoids extra finger movement:
    singleQuote: true

    // Avoid thrashing, assert default?
    arrowParens: "always"

    // avoid XO default `false` https://github.com/xojs/xo/pull/616/files
    bracketSpacing: true,
    }
    // Devins personal preferences:
    singleQuote: true, // Also avoids extra finger movement:
    semi: false, // less visual clutter

    printWidth: 40,
    // determined here:
    // commit 27987c4b47834a1fff9402b729d3a39d7539b6f9
    // Author: Rhode, Devin <[email protected]>
    // Date: Wed Oct 27 16:29:49 2021 -0500
    //
    // wip redirect manager
    //
    // It also makes inline-diff highlighting less relelvant.
    // - In VSCode, if you edit the last character in a line, it may be hard to see the actual change.
    // - Or if there's a one-letter typo... VSCode will highlight that one character change
    // - However, with a low printWidth, code becomes very vertical
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line

    // Required:
    bracketSameLine: false,
    jsxBracketSameLine: false, // deprecated in 2.4

    // Required:
    trailingComma: 'all',

    // Cannot be "consistent" - would cause thrashing in git history:
    quoteProps: "as-needed", // Could go with "preserve" if it makes more sense in some situation

    // Avoid thrashing, assert default?
    arrowParens: "always",

    // avoid XO default `false` https://github.com/xojs/xo/pull/616/files
    bracketSpacing: true,
    }
    20 changes: 20 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    These prettier config settings are intended to reduce merge conflicts as much as possible.

    My original google searches:

    what prettier options are best for git diffs

    what prettier options are best for git diffs avoid merge conflicts

    what prettier options are best for git diffs avoid merge conflicts "trailingComma"

    prettier lowest printWidth

    Something I would like, is an eslint config that is _very similar_ to prettier, but does has less deterministic formatting
    - I sense starting with Standard.js or XO eslint style config would be a good starting point.

    I'm curious what doing a format with printWidth: 1, and then doing a normal format would be like.

    Sometimes prettier will make things more vertical, but not make them more horizontal.

    Obviously more vertical is best for reducing merge conflicts.
  7. devinrhode2 renamed this gist Nov 21, 2021. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions README.md → .prettierrc.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # These prettier config settings are intended to reduce merge conflicts as much as possible.
    /*
    These prettier config settings are intended to reduce merge conflicts as much as possible.
    My original google searches:
    what prettier options are best for git diffs
    @@ -12,9 +13,8 @@ Something I would like, is an eslint config that is _very similar_ to prettier,
    I'm curious what doing a format with printWidth: 1, and then doing a normal format would be like.
    Sometimes prettier will make things more vertical, but not make them more horizontal.
    Obviously more vertical is best for reducing merge conflicts.
    */


    ```ts
    /** @type {import('prettier').RequiredOptions} */
    module.exports = {
    printWidth: 40,
    @@ -52,5 +52,4 @@ arrowParens: "always"

    // avoid XO default `false` https://github.com/xojs/xo/pull/616/files
    bracketSpacing: true,
    }
    ```
    }
  8. devinrhode2 revised this gist Nov 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ Sometimes prettier will make things more vertical, but not make them more horizo
    Obviously more vertical is best for reducing merge conflicts.


    ```js
    ```ts
    /** @type {import('prettier').RequiredOptions} */
    module.exports = {
    printWidth: 40,
  9. devinrhode2 created this gist Nov 21, 2021.
    56 changes: 56 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    # These prettier config settings are intended to reduce merge conflicts as much as possible.

    My original google searches:
    what prettier options are best for git diffs
    what prettier options are best for git diffs avoid merge conflicts
    what prettier options are best for git diffs avoid merge conflicts "trailingComma"
    prettier lowest printWidth

    Something I would like, is an eslint config that is _very similar_ to prettier, but does has less deterministic formatting
    - I sense starting with Standard.js or XO eslint style config would be a good starting point.

    I'm curious what doing a format with printWidth: 1, and then doing a normal format would be like.
    Sometimes prettier will make things more vertical, but not make them more horizontal.
    Obviously more vertical is best for reducing merge conflicts.


    ```js
    /** @type {import('prettier').RequiredOptions} */
    module.exports = {
    printWidth: 40,
    // determined here:
    // commit 27987c4b47834a1fff9402b729d3a39d7539b6f9 (origin/chore-dgr-dropping-xo-fix-all-script, chore-dgr-dropping-xo-fix-all-script)
    // Author: Rhode, Devin <[email protected]>
    // Date: Wed Oct 27 16:29:49 2021 -0500
    //
    // wip redirect manager
    //
    // It also makes inline-diff highlighting less relelvant.
    // - In VSCode, if you edit the last character in a line, it may be hard to see the actual change.
    // - Or if there's a one-letter typo... VSCode will highlight that one character change
    // - However, with a low printWidth, code becomes very vertical
    // - Of course, still aasier to spot single character change with VSCode's help, but
    // - Since there's less characters overall, there's less code to look through on any given line


    // Required:
    bracketSameLine: false,
    jsxBracketSameLine: false // deprecated in 2.4

    // Required:
    trailingComma: 'all'

    // Cannot be "consistent" - would cause thrashing in git history:
    quoteProps: "as-needed" // Could go with "preserve" if it makes more sense in some situation

    // Devins personal preference:
    // Also avoids extra finger movement:
    singleQuote: true

    // Avoid thrashing, assert default?
    arrowParens: "always"

    // avoid XO default `false` https://github.com/xojs/xo/pull/616/files
    bracketSpacing: true,
    }
    ```