Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
[IMP] Add Prettier and ESLint with --fix
Browse files Browse the repository at this point in the history
This commit includes:

- Using https://prettier.io/ for supported file formats (these include CSS, SCSS, JS, HTML, MD, YAML and others; see website).
- Transform `.eslintrc` (deprecated) to `.eslintrc.yml`, which supports more advanced syntax.
- Simplify `.eslintrc.yml` removing disabled checks. All checks are disabled by default anyways.
- Remove from `.eslintrc.yml` all stylistic checks that would conflict with Prettier.
- Add `Promise` as a builtin for v13 (this was missed before, so I take this chance to add that).
- Format properly `.travis.yml` so that when it gets merged downstream it gets less diffs when passed trhough Prettier.
- Use `eslint --fix` so we get less warnings and more fixes.
- Add prettier ignoration tags to README.md template, to avoid double-formatting addons table section.

Some insights:

- See OCA/web#1441 as an example of how a web repo looks after this change.
- A beta XML Prettier plugin exists, which could be used in the future to autoformat XML files too!
  - But it's not usable for us right now, as you can see in prettier/plugin-xml#13 (comment)
  - Once that's fixed, we can use a configuration similar to prettier/plugin-xml#17 (comment) to integrate here.
  • Loading branch information
yajo committed Nov 28, 2019
1 parent 7190b98 commit dd062cc
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 375 deletions.
38 changes: 19 additions & 19 deletions sample_files/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: python
cache:
directories:
- $HOME/.cache/pip
# Add cache for pre-commit on repo that uses it (mandatory for >= 13)
- $HOME/.cache/pre-commit
- $HOME/.cache/pip
# Add cache for pre-commit on repo that uses it (mandatory for >= 13)
- $HOME/.cache/pre-commit

python:
# For branches <= 10.0, put `- "2.7.13"`
Expand All @@ -20,7 +20,7 @@ addons:
# Search your sources alias here:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
packages:
- expect-dev # provides unbuffer utility
- expect-dev # provides unbuffer utility
# Search your packages here:
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
# For wkhtmltopdf, see the env section below
Expand Down Expand Up @@ -69,21 +69,21 @@ jobs:

env:
global:
- VERSION="10.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
# Set this variable to some version existing as linux-generic build on
# https://github.com/wkhtmltopdf/wkhtmltopdf/releases
# if you need to install wkhtmltopdf
# - WKHTMLTOPDF_VERSION="0.12.5"
# Set the above to install a `wkhtmltopdf` version that is not the one provided
# by the `pov-wkhtmltopdf` repo.
- PHANTOMJS_VERSION="latest"
# The above line controls the PhantomJS version that is used for JS testing.
# It is not necessary to include this value unless you are altering the default.
# Use `OS` to skip the PhantomJS upgrade & use the system version instead.
- WEBSITE_REPO="1"
# Use the above line to install dependencies that are required for website repos:
# * SASS & Bootstrap-SASS
# * Compass
- VERSION="10.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
# Set this variable to some version existing as linux-generic build on
# https://github.com/wkhtmltopdf/wkhtmltopdf/releases
# if you need to install wkhtmltopdf
# - WKHTMLTOPDF_VERSION="0.12.5"
# Set the above to install a `wkhtmltopdf` version that is not the one provided
# by the `pov-wkhtmltopdf` repo.
- PHANTOMJS_VERSION="latest"
# The above line controls the PhantomJS version that is used for JS testing.
# It is not necessary to include this value unless you are altering the default.
# Use `OS` to skip the PhantomJS upgrade & use the system version instead.
- WEBSITE_REPO="1"
# Use the above line to install dependencies that are required for website repos:
# * SASS & Bootstrap-SASS
# * Compass

install:
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
Expand Down
2 changes: 2 additions & 0 deletions sample_files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

${REPO_DESCRIPTION}

<!-- prettier-ignore-start -->
[//]: # (addons)
This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools.
[//]: # (end addons)
<!-- prettier-ignore-end -->

----

Expand Down
291 changes: 0 additions & 291 deletions sample_files/pre-commit-13.0/.eslintrc

This file was deleted.

Loading

0 comments on commit dd062cc

Please sign in to comment.