diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..3716cc1 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,14 @@ +module.exports = { + env: { + worker: true, + es6: true, + }, + rules: { + 'no-unused-vars': ['error', { argsIgnorePattern: 'request' }], + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + extends: ['eslint:recommended', 'plugin:prettier/recommended'], +} diff --git a/.prettierrc b/.prettierrc index a06a385..c88beb5 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,5 +3,5 @@ "semi": false, "trailingComma": "all", "tabWidth": 2, - "printWidth": 80 + "printWidth": 100 } diff --git a/package.json b/package.json index 2625b6a..5fa4f4d 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,23 @@ { - "private": true, - "name": "{{ project-name }}", "version": "1.0.0", "description": "A template for kick starting a Cloudflare Workers project", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "format": "prettier --write '**/*.{js,css,json,md}'" + "format": "eslint --fix *.js" }, "author": "{{ authors }}", "license": "MIT", "devDependencies": { - "prettier": "^1.18.2" + "eslint": "^6.5.1", + "eslint-config-prettier": "^6.4.0", + "eslint-plugin-prettier": "^3.1.1", + "husky": "^2.1.0" + }, + "husky": { + "hooks": { + "pre-commit": "npm run format", + "pre-push": "npm run format" + } } }