Skip to content

Commit

Permalink
Setup recommended eslint preset (#1345)
Browse files Browse the repository at this point in the history
This is usually enough to prevent silly mistakes.
Formatting will be done by prettier after merging pull requests.
  • Loading branch information
TrySound committed Feb 19, 2021
1 parent feefdc0 commit a7cc20b
Show file tree
Hide file tree
Showing 24 changed files with 657 additions and 84 deletions.
19 changes: 0 additions & 19 deletions .editorconfig

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/main.yml
Expand Up @@ -26,3 +26,4 @@ jobs:
- run: npm ci
- run: npm test
- run: npm run test-browser
- run: npm run lint
3 changes: 0 additions & 3 deletions .jshintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion examples/test.js
Expand Up @@ -49,7 +49,7 @@ FS.readFile(filepath, 'utf8', function(err, data) {
throw err;
}

const result = svgo.optimize(data, {path: filepath, ...config});
const result = optimize(data, {path: filepath, ...config});

console.log(result);

Expand Down
1 change: 1 addition & 0 deletions lib/svgo-node.js
Expand Up @@ -39,6 +39,7 @@ const loadConfig = async (configFile, cwd = process.cwd()) => {
}
}
let dir = cwd;
// eslint-disable-next-line no-constant-condition
while (true) {
const file = path.join(dir, "svgo.config.js");
if (await isFile(file)) {
Expand Down
7 changes: 4 additions & 3 deletions lib/svgo/coa.js
@@ -1,4 +1,3 @@
/* jshint quotmark: false */
'use strict';

const FS = require('fs');
Expand Down Expand Up @@ -46,7 +45,7 @@ module.exports = function makeProgram(program) {
.action(action);
}

async function action(args, opts) {
async function action(args, opts, command) {
var input = opts.input || args;
var output = opts.output;
var config = {}
Expand Down Expand Up @@ -91,7 +90,9 @@ async function action(args, opts) {
!opts.stdin &&
!opts.folder &&
process.stdin.isTTY === true
) return program.help();
) {
return command.help();
}

if (typeof process == 'object' && process.versions && process.versions.node && PKG && PKG.engines.node) {
var nodeVersion = String(PKG.engines.node).match(/\d*(\.\d+)*/)[0];
Expand Down
1 change: 0 additions & 1 deletion lib/svgo/jsAPI.js
Expand Up @@ -225,7 +225,6 @@ JSAPI.prototype.renameElem = function(name) {
* @return {Object|Undefined}
*/
JSAPI.prototype.computedAttr = function(name, val) {
/* jshint eqnull: true */
if (!arguments.length) return;

for (var elem = this; elem && (!elem.hasAttr(name) || !elem.attr(name).value); elem = elem.parentNode);
Expand Down
2 changes: 1 addition & 1 deletion lib/svgo/svg2js.js
Expand Up @@ -4,7 +4,7 @@ var SAX = require('sax'),
JSAPI = require('./jsAPI.js'),
CSSClassList = require('./css-class-list'),
CSSStyleDeclaration = require('./css-style-declaration'),
entityDeclaration = /<!ENTITY\s+(\S+)\s+(?:'([^\']+)'|"([^\"]+)")\s*>/g;
entityDeclaration = /<!ENTITY\s+(\S+)\s+(?:'([^']+)'|"([^"]+)")\s*>/g;

var config = {
strict: true,
Expand Down

0 comments on commit a7cc20b

Please sign in to comment.