From da0404f2b5959cfa63b965c759ed4908a7c09140 Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Sat, 15 Feb 2025 00:02:23 +0100 Subject: [PATCH] Use ESLint directly --- .github/CONTRIBUTING.md | 2 ++ .github/workflows/coding-standards.yml | 12 ++++++++++++ GNUmakefile | 3 +++ package.json | 3 ++- webpack.config.js | 1 - 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 61d1b5e76..b9895858c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -55,3 +55,5 @@ To run the tests locally run `make test`. To run the PHP formatter run `make fix-cs`. To run the PHPStan static analysis run `make phpstan`. + +To run the JS linter run `make lint-js`. diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index a4f6db096..ec4bb2eba 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -30,6 +30,12 @@ jobs: env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Install Node" + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: 'yarn' + - name: "Setup MySQL" run: | sudo systemctl start mysql.service @@ -41,6 +47,9 @@ jobs: with: composer-options: "--optimize-autoloader --prefer-dist" + - name: "Install dependencies with Yarn" + run: yarn install + - name: "Run Composer validate" run: "composer validate" @@ -61,3 +70,6 @@ jobs: - name: "Run ergebnis/composer-normalize" run: "composer normalize --dry-run --no-check-lock" + + - name: "Run ESLint" + run: "yarn lint:js" diff --git a/GNUmakefile b/GNUmakefile index 2e7f1b43b..365d7ddef 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -52,6 +52,9 @@ fix-cs: ## Run PHP-CS-Fixer phpstan: ## Run PHPStan @$(PHP_NO_XDEBUG) bin/phpstan analyse +lint-js: ## Run ESLint + @$(YARN) lint:js + release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`). ifndef VERSION $(error VERSION is not set) diff --git a/package.json b/package.json index 6e4606964..495f18d71 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "dev-server": "encore dev-server", "build:dev": "encore dev", "watch": "encore dev --watch", - "build:prod": "encore production --progress" + "build:prod": "encore production --progress", + "lint:js": "eslint assets/*.js assets/js/*.js assets/js/**/*.js" } } diff --git a/webpack.config.js b/webpack.config.js index 8d596043f..56bff7fcf 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,7 +24,6 @@ Encore .enableSassLoader() .enablePostCssLoader() .autoProvidejQuery() - .enableEslintPlugin() .addPlugin(new StyleLintPlugin({ configFile: 'stylelint.config.js', failOnError: false,