Skip to content

Commit

Permalink
Start using pre-commit and update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
sblask committed Feb 27, 2024
1 parent 9bfc77d commit e660864
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 91 deletions.
Empty file removed .eslintignore
Empty file.
61 changes: 0 additions & 61 deletions .eslintrc.json

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/build.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build

on:
pull_request:
push:

jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:

- repo: local
hooks:

- id: eslint
name: eslint
entry: eslint
language: node
types_or:
- javascript
additional_dependencies:
- "@eslint/js@8.54.0"
- "@stylistic/eslint-plugin-js@1.4.0"
- eslint@8.54.0
- globals@13.23.0

- id: web-ext lint
name: web-ext lint
entry: web-ext lint
language: node
types_or:
- javascript
pass_filenames: false
additional_dependencies:
- web-ext@7.8.0
88 changes: 88 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
const globals = require("globals");
const js = require("@eslint/js");
const stylistic = require("@stylistic/eslint-plugin-js");

module.exports = [
{
ignores: [
"base64.js",
"browser-polyfill.js",
],
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.es6,
...globals.jquery,
...globals.webextensions,
},
parserOptions: {
ecmaVersion: 2020,
},
},
plugins: {
stylistic: stylistic,
},
rules:{
...js.configs.recommended.rules,
"no-restricted-syntax": [
"error",
"ForInStatement",
],
"no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_[^_]",
"varsIgnorePattern": "^_[^_]",
},
],
"no-var": "error",
"prefer-const": "error",
"stylistic/array-bracket-newline": [
"error",
"consistent",
],
"stylistic/array-bracket-spacing": [
"error",
"never",
],
"stylistic/comma-dangle": [
"error",
{
"arrays": "always-multiline",
"exports": "always-multiline",
"functions": "only-multiline",
"imports": "always-multiline",
"objects": "always-multiline",
},
],
"stylistic/indent": [
"error",
4,
{
"SwitchCase": 1,
},
],
"stylistic/linebreak-style": [
"error",
"unix",
],
"stylistic/no-console": [
"off",
],
"stylistic/object-curly-spacing": [
"error",
"never",
],
"stylistic/quotes": [
"error",
"double",
],
"stylistic/semi": [
"error",
"always",
],
},
},
];
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"author": "Sebastian Blask",
"devDependencies": {
"eslint": "8.9.x",
"web-ext": "6.7.x"
"@eslint/js": "^8.54.0",
"@stylistic/eslint-plugin-js": "^1.4.0",
"eslint": "^8.54.0",
"web-ext": "^7.8.0"
},
"license": "MIT",
"name": "donotclosebrowserwithlasttab",
Expand All @@ -26,8 +28,7 @@
"readme": "cat README.md | sed -r 's/\\[.+\\]\\((.+)\\)/\\1/' | sed -r '/\\[/{ N; s/\\[.+\\]\\((.+)\\)/\\n\\1/ }' | sed -r '/```/,/```/d' | vim -",
"release": "VERSION=$(jq --raw-output '.version' manifest.json); hub release create $(for file in *$VERSION*.zip; do echo \" -a ${file} \"; done) -m $VERSION $VERSION",
"start": "GTK_THEME=Greybird web-ext run --verbose --firefox firefox",
"start:nightly": "GTK_THEME=Greybird web-ext run --verbose --firefox firefox-trunk",
"test": "web-ext lint"
"start:nightly": "GTK_THEME=Greybird web-ext run --verbose --firefox firefox-trunk"
},
"title": "Do not close browser with last tab",
"version": "1.0.0"
Expand Down

0 comments on commit e660864

Please sign in to comment.