From cbed5e331b02b95f09ee6aab7d703ce2b896d558 Mon Sep 17 00:00:00 2001 From: Fabien Basmaison Date: Mon, 5 Apr 2021 16:17:11 +0200 Subject: [PATCH] [assets] Move some frontend assets to _vendor_ directories: This simplifies linting of files we have no grasp on, and clarifies responsibilities. - Add .eslintignore. - Restrict linting to bookwyrm/static. --- .eslintignore | 1 + .github/workflows/lint-frontend.yaml | 6 ++++-- .stylelintignore | 3 +-- bookwyrm/static/css/{ => vendor}/bulma.css.map | 0 bookwyrm/static/css/{ => vendor}/bulma.min.css | 0 bookwyrm/static/css/{ => vendor}/icons.css | 0 bookwyrm/static/js/{ => vendor}/tabs.js | 0 bookwyrm/templates/book/book.html | 2 +- bookwyrm/templates/feed/feed_layout.html | 2 +- bookwyrm/templates/layout.html | 6 +++--- 10 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 .eslintignore rename bookwyrm/static/css/{ => vendor}/bulma.css.map (100%) rename bookwyrm/static/css/{ => vendor}/bulma.min.css (100%) rename bookwyrm/static/css/{ => vendor}/icons.css (100%) rename bookwyrm/static/js/{ => vendor}/tabs.js (100%) diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..b2cd33f89 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +**/vendor/** diff --git a/.github/workflows/lint-frontend.yaml b/.github/workflows/lint-frontend.yaml index 978bbbbe5..4c5e88234 100644 --- a/.github/workflows/lint-frontend.yaml +++ b/.github/workflows/lint-frontend.yaml @@ -22,8 +22,10 @@ jobs: - name: Install modules run: yarn + # See .stylelintignore for files that are not linted. - name: Run stylelint - run: yarn stylelint **/static/**/*.css --report-needless-disables --report-invalid-scope-disables + run: yarn stylelint bookwyrm/static/**/*.css --report-needless-disables --report-invalid-scope-disables + # See .eslintignore for files that are not linted. - name: Run ESLint - run: yarn eslint . --ext .js,.jsx,.ts,.tsx + run: yarn eslint bookwyrm/static --ext .js,.jsx,.ts,.tsx diff --git a/.stylelintignore b/.stylelintignore index f456cb226..b2cd33f89 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -1,2 +1 @@ -bookwyrm/static/css/bulma.*.css* -bookwyrm/static/css/icons.css +**/vendor/** diff --git a/bookwyrm/static/css/bulma.css.map b/bookwyrm/static/css/vendor/bulma.css.map similarity index 100% rename from bookwyrm/static/css/bulma.css.map rename to bookwyrm/static/css/vendor/bulma.css.map diff --git a/bookwyrm/static/css/bulma.min.css b/bookwyrm/static/css/vendor/bulma.min.css similarity index 100% rename from bookwyrm/static/css/bulma.min.css rename to bookwyrm/static/css/vendor/bulma.min.css diff --git a/bookwyrm/static/css/icons.css b/bookwyrm/static/css/vendor/icons.css similarity index 100% rename from bookwyrm/static/css/icons.css rename to bookwyrm/static/css/vendor/icons.css diff --git a/bookwyrm/static/js/tabs.js b/bookwyrm/static/js/vendor/tabs.js similarity index 100% rename from bookwyrm/static/js/tabs.js rename to bookwyrm/static/js/vendor/tabs.js diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index b91cebbac..a7887c61e 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -267,5 +267,5 @@ {% endblock %} {% block scripts %} - + {% endblock %} diff --git a/bookwyrm/templates/feed/feed_layout.html b/bookwyrm/templates/feed/feed_layout.html index 9afd5e600..edbab016e 100644 --- a/bookwyrm/templates/feed/feed_layout.html +++ b/bookwyrm/templates/feed/feed_layout.html @@ -104,5 +104,5 @@ {% endblock %} {% block scripts %} - + {% endblock %} diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index ccc52a501..c1ff12762 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -5,9 +5,9 @@ {% block title %}BookWyrm{% endblock %} | {{ site.name }} - - - + + +