Skip to content

Commit

Permalink
ci: add linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bchew committed Feb 6, 2025
1 parent 4d7b13e commit e732a17
Show file tree
Hide file tree
Showing 6 changed files with 3,977 additions and 399 deletions.
1 change: 1 addition & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
- run: npm ci --update-notifier=false
- run: npm run lint
- run: npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const eslintConfigAdslot = require('eslint-config-adslot');

module.exports = [...eslintConfigAdslot];
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const fs = require('fs'); // eslint-disable-line id-length
const fs = require('fs');
const pug = require('pug');
const url = require('url');
const assert = require('assert');
Expand All @@ -17,7 +17,6 @@ const defaultOptions = {
maxAge: 0,
};


module.exports = (opts) => {
if (!opts.baseDir) {
throw new Error('baseDir should be set');
Expand Down Expand Up @@ -50,8 +49,8 @@ module.exports = (opts) => {
}

if (!stats.isFile()) {
return next();
}
return next();

Check warning on line 52 in index.js

View check run for this annotation

Codecov / codecov/patch

index.js#L52

Added line #L52 was not covered by tests
}

pug.renderFile(filePath, newOpts.pug, (renderErr, html) => {
if (renderErr) {
Expand All @@ -70,7 +69,6 @@ module.exports = (opts) => {
};
};


module.exports.getDefaultOptions = (opts = {}) => {
opts = opts || {};
Object.keys(defaultOptions).forEach((optionName) => {
Expand All @@ -81,7 +79,6 @@ module.exports.getDefaultOptions = (opts = {}) => {
return opts;
};


module.exports.getTplPath = (requestUrl, opts) => {
const newOpts = module.exports.getDefaultOptions(opts);
assert(newOpts.ext && Array.isArray(newOpts.ext), 'newOpts.ext should be provided and be an array');
Expand Down
Loading

0 comments on commit e732a17

Please sign in to comment.