🥅 Add eslint with ES5 enforcement

Make sure our core JS files stay ES5 compatible.

Alternatively we could find a way run them through babel first, initial
experiments with dukpy have sadly resulted in a blocked server, so far
no clue why.

Related to #3920
This commit is contained in:
Gina Häußge committed 2021-02-08 18:13:30 +01:00
1 parent 2913eb5fd8
commit a9ea150b92
4 files changed
+63 -17

No files matched your search

+1
View File
@@ -0,0 +1 @@
tests/cypress/**
+22
View File
@@ -0,0 +1,22 @@
env:
browser: true
jquery: true
parserOptions:
ecmaVersion: 5
rules: {}
overrides:
- files:
- "src/octoprint/static/js/app/**"
rules:
es5/no-block-scoping: error
es5/no-arrow-functions: error
es5/no-default-parameters: error
es5/no-rest-parameters: error
es5/no-spread: error
es5/no-destructuring: error
es5/no-for-of: error
es5/no-generators: error
es5/no-template-literals: error
plugins:
- eslint-plugin-es5
+34 -17
View File
@@ -46,22 +46,6 @@ jobs:
run: |
pre-commit run --hook-stage manual black --all-files --show-diff-on-failure
lint-prettier:
name: 🧹 prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run prettier
run: |
pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure
lint-isort:
name: 🧹 isort
runs-on: ubuntu-latest
@@ -94,6 +78,38 @@ jobs:
run: |
pre-commit run --hook-stage manual flake8 --all-files
lint-prettier:
name: 🧹 prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run prettier
run: |
pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure
lint-eslint:
name: 🧹 eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run eslint
run: |
pre-commit run --hook-stage manual eslint --all-files
test-unit:
name: 🧪 Unit tests
strategy:
@@ -192,9 +208,10 @@ jobs:
if: github.event_name == 'release'
needs:
- lint-black
- lint-prettier
- lint-isort
- lint-flake8
- lint-prettier
- lint-eslint
- test-unit
- test-install
- test-e2e
+6
View File
@@ -42,3 +42,9 @@ repos:
rev: v2.1.2
hooks:
- id: prettier
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.19.0
hooks:
- id: eslint
additional_dependencies:
- eslint-plugin-es5@v1.3.0