Use XO for linting

This commit is contained in:
Lynn Smeria 2018-11-11 10:28:14 +01:00
parent fa597a9339
commit fb1dc7ae42
10 changed files with 753 additions and 45 deletions

View file

@ -1,10 +0,0 @@
parserOptions:
ecmaVersion: 2018
sourceType: module
env:
node: true
extends:
- airbnb-base
- prettier
rules:
no-param-reassign: off

View file

@ -1,7 +1,6 @@
{ {
"prettier.singleQuote": true,
"prettier.trailingComma": "es5",
"editor.rulers": [80, 100], "editor.rulers": [80, 100],
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.tabSize": 2 "editor.tabSize": 2,
"xo.enable": true
} }

View file

@ -11,6 +11,14 @@
"engines": { "engines": {
"node": ">=8" "node": ">=8"
}, },
"xo": {
"prettier": true
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"useTabs": false
},
"dependencies": { "dependencies": {
"@types/mime-types": "2.1.0", "@types/mime-types": "2.1.0",
"caporal": "0.10.0", "caporal": "0.10.0",
@ -24,12 +32,8 @@
"walkdir": "0.0.12" "walkdir": "0.0.12"
}, },
"devDependencies": { "devDependencies": {
"eslint": "5.4.0", "nodemon": "1.18.3",
"eslint-config-airbnb-base": "13.1.0", "xo": "0.23.0"
"eslint-config-prettier": "3.0.1",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.1",
"nodemon": "1.18.3"
}, },
"scripts": { "scripts": {
"dev": "nodemon src/cli.js" "dev": "nodemon src/cli.js"

View file

@ -1,3 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node
// eslint-disable-next-line
require('./src/cli'); require('./src/cli');

View file

@ -1,13 +1,13 @@
const path = require('path');
const debugModule = require('debug'); const debugModule = require('debug');
const fs = require('fs-extra'); const fs = require('fs-extra');
const path = require('path');
const program = require('caporal'); const program = require('caporal');
const packageJson = require('../package.json');
const scan = require('./scan'); const scan = require('./scan');
const organise = require('./organise'); const organise = require('./organise');
const generate = require('./generate'); const generate = require('./generate');
const debug = debugModule('publikator:cli'); const debug = debugModule('publikator:cli');
const packageJson = require('../package.json');
process.on('unhandledRejection', error => { process.on('unhandledRejection', error => {
throw error; throw error;

View file

@ -1,5 +1,5 @@
const fs = require('fs-extra');
const path = require('path'); const path = require('path');
const fs = require('fs-extra');
const _ = require('lodash'); const _ = require('lodash');
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const debug = require('debug')('publikator:generate'); const debug = require('debug')('publikator:generate');
@ -8,8 +8,8 @@ const debug = require('debug')('publikator:generate');
* Collects unique values across a number of tracks. * Collects unique values across a number of tracks.
*/ */
const collect = (tracks, callback) => { const collect = (tracks, callback) => {
const values = _.uniq(_.flatten(tracks.map(t => callback(t)))).filter( const values = _.uniq(_.flatten(tracks.map(t => callback(t)))).filter(x =>
x => !!x Boolean(x)
); );
if (values.length === 0) { if (values.length === 0) {
return null; return null;

View file

@ -1,5 +1,5 @@
const fs = require('fs-extra');
const path = require('path'); const path = require('path');
const fs = require('fs-extra');
const _ = require('lodash'); const _ = require('lodash');
const sanitize = require('sanitize-filename'); const sanitize = require('sanitize-filename');
const debug = require('debug')('publikator:organise'); const debug = require('debug')('publikator:organise');

View file

@ -1,5 +1,5 @@
const debug = require('debug')('publikator:scan');
const path = require('path'); const path = require('path');
const debug = require('debug')('publikator:scan');
const walk = require('walkdir'); const walk = require('walkdir');
const tags = require('./tags'); const tags = require('./tags');

View file

@ -60,7 +60,7 @@ module.exports = {
tags.reduce((all, tag) => { tags.reduce((all, tag) => {
const value = _.get(taggedFile, tag); const value = _.get(taggedFile, tag);
if (value !== undefined) { if (value !== undefined) {
all[tag] = value; // eslint-disable-line all[tag] = value;
} }
return all; return all;
}, {}), }, {}),

750
yarn.lock

File diff suppressed because it is too large Load diff