Skip to content

Commit

Permalink
Added ESLint as dev dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Oct 11, 2024
1 parent d90e639 commit 1cb89d7
Show file tree
Hide file tree
Showing 5 changed files with 1,026 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ESLint

on: [push, pull_request]

jobs:
eslint:
runs-on: ubuntu-latest
steps:

- name: Checkout repository code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 21

- name: Install dependencies
run: npm ci # instead of install to ensure consistency and determinism in CI/CD workflow

- name: Run ESLint
run: npm run lint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.eslintcache
20 changes: 20 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import js from '@eslint/js';

export default [
js.configs.recommended,
{
rules: {
'indent': 'off', 'no-unexpected-multiline': 'off', 'key-spacing': 'off', // allow whitespace anywhere
'quotes': ['error', 'single', { 'allowTemplateLiterals': true }], // enforce single quotes except backticks to avoid escaping quotes
'comma-dangle': ['error', 'never'], // enforce no trailing commas in arrays or objects
'no-async-promise-executor': 'off', // allow promise executor functions to be async (to accomodate await lines)
'no-constant-condition': 'off', // allow constant conditions
'no-empty': 'off', // allow empty blocks
'no-inner-declarations': 'off', // allow function declarations anywhere
'no-useless-escape': 'off', // allow all escape chars cause ESLint sucks at detecting truly useless ones
'no-unused-vars': ['error', { 'caughtErrors': 'none' }] // allow unused named args in catch blocks
},
languageOptions: { ecmaVersion: 2022, sourceType: 'script', globals: { chrome: 'readonly' }}
},
{ files: ['**/*.mjs'], languageOptions: { sourceType: 'module' }}
];
Loading

0 comments on commit 1cb89d7

Please sign in to comment.