Skip to content

Commit

Permalink
Add linting and cleanup accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
karlpauls committed Feb 6, 2024
1 parent 4d35d26 commit 5e6fddc
Show file tree
Hide file tree
Showing 22 changed files with 4,195 additions and 1,383 deletions.
52 changes: 52 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module.exports = {
root: true,
extends: 'airbnb-base',
env: { browser: true, mocha: true },
parser: '@babel/eslint-parser',
parserOptions: {
allowImportExportEverywhere: true,
sourceType: 'module',
requireConfigFile: false,
},
rules: {
'no-param-reassign': [2, { props: false }],
'linebreak-style': ['error', 'unix'],
'import/extensions': ['error', { js: 'always' }],
'object-curly-newline': ['error', {
ObjectExpression: { multiline: true, minProperties: 6 },
ObjectPattern: { multiline: true, minProperties: 6 },
ImportDeclaration: { multiline: true, minProperties: 6 },
ExportDeclaration: { multiline: true, minProperties: 6 },
}],
'no-await-in-loop': 0,
'class-methods-use-this': 0,
'no-return-assign': ['error', 'except-parens'],
'no-unused-expressions': 0,
'chai-friendly/no-unused-expressions': 2,
'no-underscore-dangle': ['error', { allowAfterThis: true }],
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'LabeledStatement',
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
},
overrides: [
{
files: ['test/**/*.js'],
rules: { 'no-console': 'off' },
},
],
plugins: [
'chai-friendly',
],
};
14 changes: 14 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint
Loading

0 comments on commit 5e6fddc

Please sign in to comment.