Skip to content

Commit

Permalink
Align linting config with Assetgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
Munter committed Oct 20, 2019
1 parent 74dbc9b commit 64c45a1
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 39 deletions.
17 changes: 17 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": ["standard", "prettier", "prettier/standard"],
"plugins": ["mocha"],
"rules": {
"prefer-template": "error",
"mocha/no-exclusive-tests": "error",
"mocha/no-nested-tests": "error",
"mocha/no-identical-title": "error",
"prefer-const": [
"error",
{
"destructuring": "all",
"ignoreReadBeforeAssign": false
}
]
}
}
15 changes: 0 additions & 15 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ module.exports = async (argv, console) => {
}
}
} else if (rootUrl && rootUrl.startsWith('file:')) {
inputUrls = [rootUrl + '**/*.html'];
console.error('No input files specified, defaulting to ' + inputUrls[0]);
inputUrls = [`${rootUrl}**/*.html`];
console.error(`No input files specified, defaulting to ${inputUrls[0]}`);
} else {
console.error(
"No input files and no --root specified (or it isn't file:), cannot proceed.\n"
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@
},
"devDependencies": {
"coveralls": "^3.0.2",
"eslint": "^5.6.1",
"eslint-config-pretty-standard": "^2.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-config-standard": "^14.0.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-mocha": "^6.0.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"httpception": "^2.0.0",
"mocha": "^5.2.0",
"nyc": "^13.0.1",
Expand Down
2 changes: 2 additions & 0 deletions test/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env:
mocha: true
36 changes: 17 additions & 19 deletions test/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global describe, it*/
/* global describe, it */
const sinon = require('sinon');
const expect = require('unexpected').clone();
const main = require('../lib/main');
Expand Down Expand Up @@ -55,14 +55,13 @@ describe('subfont', function() {
]);

const rootUrl = encodeURI(
'file://' +
pathModule.resolve(
__dirname,
'..',
'testdata',
'stylesheetAtOtherOrigin',
'referencesFont'
)
`file://${pathModule.resolve(
__dirname,
'..',
'testdata',
'stylesheetAtOtherOrigin',
'referencesFont'
)}`
);

const assetGraph = await main(
Expand All @@ -76,7 +75,7 @@ describe('subfont', function() {
expect(
cssAsset.url,
'to equal',
assetGraph.root + 'subfont/styles-38ce4ca68c.css'
`${assetGraph.root}subfont/styles-38ce4ca68c.css`
);
});
});
Expand Down Expand Up @@ -113,14 +112,13 @@ describe('subfont', function() {
]);

const rootUrl = encodeURI(
'file://' +
pathModule.resolve(
__dirname,
'..',
'testdata',
'stylesheetAtOtherOrigin',
'referencesFont'
)
`file://${pathModule.resolve(
__dirname,
'..',
'testdata',
'stylesheetAtOtherOrigin',
'referencesFont'
)}`
);

const assetGraph = await main(
Expand Down Expand Up @@ -199,7 +197,7 @@ describe('subfont', function() {

it('should not dive into iframes', async function() {
const rootUrl = encodeURI(
'file://' + pathModule.resolve(__dirname, '..', 'testdata', 'iframe')
`file://${pathModule.resolve(__dirname, '..', 'testdata', 'iframe')}`
);

const assetGraph = await main(
Expand Down

0 comments on commit 64c45a1

Please sign in to comment.