diff --git a/.eslintignore b/.eslintignore index 9d8891de0..60c278861 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,5 @@ dist/** .github/** docs/Setup.md +cypress.config.js +cypress/plugins/index.js diff --git a/.eslintrc.json b/.eslintrc.json index 4c702fcbc..0da42ae61 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,6 +15,7 @@ }, "extends": [ "eslint:recommended", + "plugin:@typescript-eslint/recommended", "plugin:jsdoc/recommended", "plugin:json/recommended", "plugin:markdown/recommended", @@ -22,6 +23,7 @@ ], "plugins": ["@typescript-eslint", "html", "jest", "jsdoc", "json"], "rules": { + "no-console": "error", "no-prototype-builtins": "off", "no-unused-vars": "off", "jsdoc/check-indentation": "off", @@ -35,6 +37,16 @@ "jsdoc/require-returns": "off", "jsdoc/require-returns-description": "off", "cypress/no-async-tests": "off", + "@typescript-eslint/ban-ts-comment": [ + "error", + { + "ts-expect-error": "allow-with-description", + "ts-ignore": "allow-with-description", + "ts-nocheck": "allow-with-description", + "ts-check": "allow-with-description", + "minimumDescriptionLength": 10 + } + ], "json/*": ["error", "allowComments"], "no-empty": ["error", { "allowEmptyCatch": true }] }, @@ -45,6 +57,12 @@ "no-undef": "off", "jsdoc/require-jsdoc": "off" } + }, + { + "files": ["./cypress/**", "./demos/**"], + "rules": { + "no-console": "off" + } } ] } diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 44e2f4cb1..e567aba89 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -40,3 +40,18 @@ jobs: - name: Verify Docs run: yarn docs:verify + + - name: Check no `console.log()` in .jison files + # ESLint can't parse .jison files directly + # In the future, it might be worth making a `eslint-plugin-jison`, so + # that this will be built into the `yarn lint` command. + run: | + shopt -s globstar + mkdir -p tmp/ + for jison_file in src/**/*.jison; do + outfile="tmp/$(basename -- "$jison_file" .jison)-jison.js" + echo "Converting $jison_file to $outfile" + # default module-type (CJS) always adds a console.log() + yarn jison "$jison_file" --outfile "$outfile" --module-type "amd" + done + yarn eslint --no-eslintrc --rule no-console:error --parser "@babel/eslint-parser" "./tmp/*-jison.js" diff --git a/cypress.config.js b/cypress.config.js index 044c5d523..d7c9831d4 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ + const { defineConfig } = require('cypress'); const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin'); require('@applitools/eyes-cypress')(module); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 2c98a54ad..ca5a37d5a 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ // *********************************************************** // This example plugins/index.js can be used to load plugins // diff --git a/demos/index.html b/demos/index.html index 58234c6d7..8ef343ef1 100644 --- a/demos/index.html +++ b/demos/index.html @@ -1083,7 +1083,9 @@ Enterprise_Boundary(b0, "BankBoundary0") {