Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run lint on CI #550

Merged
merged 5 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bundlers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
run: npm install
- name: Bundle code
run: npm run test:prepare ${{ matrix.bundler }}
- name: Run Tests on Browsers
- name: Run Tests on bundler
run: npm run test:bundlers ${{ matrix.bundler }}
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint

on: [push, pull_request]

permissions:
contents: read

jobs:
lint:
name: Node.js
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Restore cached dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package.json') }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Check generated files
run: |
# Check if diff is empty
git diff --exit-code --stat ${{ github.sha }} -- lib/
- name: Check format
run: npm run test:format
- name: Check for lint issues
run: npm run lint
14 changes: 7 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { FlatCompat } from '@eslint/eslintrc'
const compat = new FlatCompat()

import eslintPluginLocal from './eslint-plugin-local/index.mjs'

const compat = new FlatCompat()

export default [
// standard,
...compat.extends('eslint-config-standard'),
{
files: ['**/**.js', '**/**.mjs'],
languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
ecmaVersion: 'latest'
},
plugins: { 'local': eslintPluginLocal },
plugins: { local: eslintPluginLocal },
rules: {
/*
This is inserted to make this compatible with prettier.
Expand All @@ -21,7 +21,7 @@ export default [
'space-before-function-paren': 0,
curly: [2, 'all'],
'local/no-big-int': 'error',
'no-undef': 'warn',
},
},
'no-undef': 'warn'
}
}
]
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"test:readable-stream-only": "node readable-stream-test/runner-prepare.mjs",
"coverage": "c8 -c ./c8.json tap --rcfile=./tap.yml test/parallel/test-*.js test/ours/test-*.js",
"format": "prettier -w src lib test",
"test:format": "prettier -c src lib test",
"lint": "eslint src"
},
"dependencies": {
Expand All @@ -55,6 +56,7 @@
"@babel/core": "^7.17.10",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
"@eslint/eslintrc": "^3.2.0",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-inject": "^4.0.4",
"@rollup/plugin-node-resolve": "^13.3.0",
Expand Down
Loading