Skip to content

Commit

Permalink
🧪 Add precommit lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nilooy committed Jul 2, 2022
1 parent 4aa08a9 commit 99de1a3
Show file tree
Hide file tree
Showing 8 changed files with 1,032 additions and 441 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extension
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"rules": {}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint-staged
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"trailingComma": "all",
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"arrowParens": "avoid"
}
7 changes: 7 additions & 0 deletions lint-staged.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
'*.{js,jsx,ts,tsx}': [
'eslint --max-warnings=0',
() => 'tsc-files --noEmit',
],
'*.{js,jsx,ts,tsx,json,css,js}': ['prettier --write'],
}
153 changes: 81 additions & 72 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,74 +1,83 @@
{
"name": "superkeys",
"displayName": "SuperKeys",
"description": "_THIS EXTENSION IS IN ALPHA_ Superkeys allow users to add short keys for websites and make search query in those sites.",
"version": "1.0.0-alpha.0",
"private": true,
"scripts": {
"start": "npm run dev:firefox",
"dev:chrome": "run-p chrome:*",
"dev:firefox": "run-p firefox:*",
"chrome:prepare": "esno scripts/prepare.ts build --watch",
"chrome:watch": "vite build --watch",
"chrome:preview": "vite preview",
"chrome:build": "tsup src/background src/content --format iife --out-dir extension/dist --no-splitting",
"chrome:open": "npm run wait && web-ext run -t chromium --start-url \"https://stackoverflow.com\" --source-dir ./extension/",
"firefox:prepare": "esno scripts/prepare.ts build --firefox --watch",
"firefox:web": "vite build --watch",
"firefox:preview": "vite preview",
"firefox:build": "tsup src/background src/content --format iife --out-dir extension/dist --no-splitting",
"firefox:open": "npm run wait && web-ext run --start-url \"about:debugging#/runtime/this-firefox\" --source-dir ./extension/ --browser-console --no-reload",
"build:chrome": "run-s clear build:web build:prepare build:js",
"build:firefox": "run-s clear build:web 'build:prepare -- --firefox' build:js",
"build:prepare": "esno scripts/prepare.ts build",
"build:web": "vite build",
"build:js": "tsup src/background src/content --format iife --out-dir extension/dist --no-splitting",
"clear": "rimraf extension/dist extension/manifest.json",
"wait": "wait-on http://localhost:4173/options/index.html",
"prod:command:divider::": "echo '@========> 🚀 PROD COMMANDS <========@'",
"prod:prepare": "mkdir -p releases/$npm_package_version",
"prod:chrome": "run-s build:chrome prod:prepare && cd extension && web-ext build --overwrite-dest --artifacts-dir=../releases/$npm_package_version && npm run post:prod:chrome",
"prod:firefox": "run-s build:firefox prod:prepare && cd extension && web-ext build --overwrite-dest --artifacts-dir=../releases/$npm_package_version && npm run post:prod:firefox",
"post:prod:chrome": "cd releases/$npm_package_version && mv superkeys-* superkeys.chrome.$npm_package_version.zip",
"post:prod:firefox": "cd releases/$npm_package_version && mv superkeys-* superkeys.firefox.$npm_package_version.zip",
"release": "release-it",
"release:alpha": "release-it major --preRelease=alpha",
"release:beta": "release-it major --preRelease=beta",
"prod": "run-s prod:chrome prod:firefox"
},
"devDependencies": {
"@iconify/react": "^3.2.2",
"@preact/preset-vite": "^2.1.0",
"@types/chrome": "^0.0.191",
"@types/fs-extra": "^9.0.12",
"@types/node": "^16.4.1",
"@types/webextension-polyfill": "^0.9.0",
"autoprefixer": "^10.4.7",
"chokidar": "^3.5.2",
"cross-env": "^7.0.3",
"esno": "^0.8.0",
"fs-extra": "^10.0.0",
"kolorist": "^1.5.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.14",
"preact": "^10.5.14",
"release-it": "^15.1.1",
"rimraf": "^3.0.2",
"tailwindcss": "^3.1.2",
"tsup": "^4.12.5",
"typescript": "^4.3.5",
"vite": "^2.4.3",
"wait-on": "^6.0.1",
"web-ext": "^7.0.0",
"webext-bridge": "^4.0.0",
"webextension-polyfill": "^0.9.0",
"webextension-polyfill-ts": "^0.26.0"
},
"dependencies": {
"daisyui": "^2.15.3",
"prettier": "^2.6.2",
"react-drag-drop-files": "^2.3.7",
"react-hook-form": "^7.32.0",
"react-simple-flex-grid": "^1.3.21"
}
"name": "superkeys",
"displayName": "SuperKeys",
"description": "_THIS EXTENSION IS IN ALPHA_ Superkeys allow users to add short keys for websites and make search query in those sites.",
"version": "1.0.0-alpha.0",
"private": true,
"scripts": {
"start": "npm run dev:firefox",
"dev:chrome": "run-p chrome:*",
"dev:firefox": "run-p firefox:*",
"chrome:prepare": "esno scripts/prepare.ts build --watch",
"chrome:watch": "vite build --watch",
"chrome:preview": "vite preview",
"chrome:build": "tsup src/background src/content --format iife --out-dir extension/dist --no-splitting",
"chrome:open": "npm run wait && web-ext run -t chromium --start-url \"https://stackoverflow.com\" --source-dir ./extension/",
"firefox:prepare": "esno scripts/prepare.ts build --firefox --watch",
"firefox:web": "vite build --watch",
"firefox:preview": "vite preview",
"firefox:build": "tsup src/background src/content --format iife --out-dir extension/dist --no-splitting",
"firefox:open": "npm run wait && web-ext run --start-url \"about:debugging#/runtime/this-firefox\" --source-dir ./extension/ --browser-console --no-reload",
"build:chrome": "run-s clear build:web build:prepare build:js",
"build:firefox": "run-s clear build:web 'build:prepare -- --firefox' build:js",
"build:prepare": "esno scripts/prepare.ts build",
"build:web": "vite build",
"build:js": "tsup src/background src/content --format iife --out-dir extension/dist --no-splitting",
"clear": "rimraf extension/dist extension/manifest.json",
"wait": "wait-on http://localhost:4173/options/index.html",
"prod:command:divider::": "echo '@========> 🚀 PROD COMMANDS <========@'",
"prod:prepare": "mkdir -p releases/$npm_package_version",
"prod:chrome": "run-s build:chrome prod:prepare && cd extension && web-ext build --overwrite-dest --artifacts-dir=../releases/$npm_package_version && npm run post:prod:chrome",
"prod:firefox": "run-s build:firefox prod:prepare && cd extension && web-ext build --overwrite-dest --artifacts-dir=../releases/$npm_package_version && npm run post:prod:firefox",
"post:prod:chrome": "cd releases/$npm_package_version && mv superkeys-* superkeys.chrome.$npm_package_version.zip",
"post:prod:firefox": "cd releases/$npm_package_version && mv superkeys-* superkeys.firefox.$npm_package_version.zip",
"release": "release-it",
"release:alpha": "release-it major --preRelease=alpha",
"release:beta": "release-it major --preRelease=beta",
"prod": "run-s prod:chrome prod:firefox",
"lint": "eslint src --color",
"lint-staged": "lint-staged --config lint-staged.js"
},
"devDependencies": {
"@iconify/react": "^3.2.2",
"@preact/preset-vite": "^2.1.0",
"@types/chrome": "^0.0.191",
"@types/fs-extra": "^9.0.12",
"@types/node": "^16.4.1",
"@types/webextension-polyfill": "^0.9.0",
"@typescript-eslint/eslint-plugin": "^5.30.3",
"@typescript-eslint/parser": "^5.30.3",
"autoprefixer": "^10.4.7",
"chokidar": "^3.5.2",
"cross-env": "^7.0.3",
"eslint": "^8.19.0",
"eslint-plugin-react": "^7.30.1",
"esno": "^0.8.0",
"fs-extra": "^10.0.0",
"husky": "^8.0.1",
"kolorist": "^1.5.0",
"lint-staged": "^13.0.3",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.14",
"preact": "^10.5.14",
"prettier": "^2.7.1",
"release-it": "^15.1.1",
"rimraf": "^3.0.2",
"tailwindcss": "^3.1.2",
"tsc-files": "^1.1.3",
"tsup": "^4.12.5",
"typescript": "^4.3.5",
"vite": "^2.4.3",
"wait-on": "^6.0.1",
"web-ext": "^7.0.0",
"webext-bridge": "^4.0.0",
"webextension-polyfill": "^0.9.0",
"webextension-polyfill-ts": "^0.26.0"
},
"dependencies": {
"daisyui": "^2.15.3",
"react-drag-drop-files": "^2.3.7",
"react-hook-form": "^7.32.0",
"react-simple-flex-grid": "^1.3.21"
}
}
Loading

0 comments on commit 99de1a3

Please sign in to comment.