Skip to content

Commit

Permalink
add eslint (#71)
Browse files Browse the repository at this point in the history
* add eslint

* start to lint files

* revert, update rules

* lint

* disable more rules

* fix more errors

* resolve all linter errors

* add linter to ci

* update package.json

* fix how dependencies are installed

* update cypress

* simplify lint command

* use prettier plugin

* remove watch command
  • Loading branch information
mldangelo authored Oct 3, 2023
1 parent eddbc79 commit 33e3141
Show file tree
Hide file tree
Showing 41 changed files with 9,550 additions and 7,709 deletions.
45 changes: 45 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
env: {
"cypress/globals": true,
browser: true,
commonjs: true,
es2021: true,
},
extends: ["airbnb-base", "plugin:prettier/recommended"],
ignorePatterns: ["build/", "dist/", "libs/", "node_modules/"],
globals: {
validate: "readonly",
JSZip: "readonly",
},
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
},
plugins: ["cypress", "prettier"],
rules: {
"class-methods-use-this": 0,
"func-names": 0,
"max-len": 0,
"no-console": ["error", { allow: ["error"] }],
"no-param-reassign": 0,
"no-restricted-globals": 0,
"no-use-before-define": 0,
"no-useless-escape": 0,
"one-var": ["error", "never"],
"prefer-destructuring": 0,
"prettier/prettier": "error",
camelcase: 0,
indent: 0,
strict: 0,
},
};
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run lint:html
- name: lint js
run: npm run lint
11 changes: 6 additions & 5 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const { defineConfig } = require('cypress')
const { defineConfig } = require("cypress"); // eslint-disable-line import/no-extraneous-dependencies

module.exports = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
// eslint-disable-next-line global-require
return require("./cypress/plugins/index")(on, config);
},
baseUrl: 'http://localhost:8000',
specPattern: 'cypress/tests/**/*.cy.{js,jsx,ts,tsx}',
baseUrl: "http://localhost:8000",
specPattern: "cypress/tests/**/*.cy.{js,jsx,ts,tsx}",
},
})
});
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
};
Loading

0 comments on commit 33e3141

Please sign in to comment.