Skip to content
Snippets Groups Projects
  • Saurabh Kumar's avatar
    4ce14204
    Add pre-commit with black,prettier and djhtml (#3502) · 4ce14204
    Saurabh Kumar authored
    - Add black, djhtml, prettier
    - Add precommit
    
    
    This PR add configurations for black, djhtml and prettier.
    
    - black is used for formatting python files
    - djhtml for formatting html files. Use `{# fmt: off #}` and `{# fmt: on
    #}` where needed.
    - prettier for formatting of sass,css,yml and js files
    
    Note: prettier picks up some of it's config from `.editorconfig`, so
    it's updated appropriately
    
    Formating of mardown files, minified or vendored js files are ignored.
    
    Formatting used off-the-self rules for better consistency with the
    community as large.
    
    The formatting is not applied to all the files as it will introduce a
    lot of merge conflict with
    current PRs, instead `pre-commit` config is provide which can be
    installed by `precommit install`
    locally. It will format only the modified files in the PR/commits. 
    
    Once majority of the current active PRs are either rebased & formatted
    using precommit or merged, we can
    run the `make fmt` on the full repo and activate additional prettier and
    black checks in our lint rules.
    
    The modified sass files fixes the eslint error that would came up if we
    were to apply the prettier formatter on them.
    
    Fixes #3500
    Add pre-commit with black,prettier and djhtml (#3502)
    Saurabh Kumar authored
    - Add black, djhtml, prettier
    - Add precommit
    
    
    This PR add configurations for black, djhtml and prettier.
    
    - black is used for formatting python files
    - djhtml for formatting html files. Use `{# fmt: off #}` and `{# fmt: on
    #}` where needed.
    - prettier for formatting of sass,css,yml and js files
    
    Note: prettier picks up some of it's config from `.editorconfig`, so
    it's updated appropriately
    
    Formating of mardown files, minified or vendored js files are ignored.
    
    Formatting used off-the-self rules for better consistency with the
    community as large.
    
    The formatting is not applied to all the files as it will introduce a
    lot of merge conflict with
    current PRs, instead `pre-commit` config is provide which can be
    installed by `precommit install`
    locally. It will format only the modified files in the PR/commits. 
    
    Once majority of the current active PRs are either rebased & formatted
    using precommit or merged, we can
    run the `make fmt` on the full repo and activate additional prettier and
    black checks in our lint rules.
    
    The modified sass files fixes the eslint error that would came up if we
    were to apply the prettier formatter on them.
    
    Fixes #3500
This project manages its dependencies using npm. Learn more