Skip to content

Commit 9dbf588

Browse files
David Hemphilladamwathan
authored andcommitted
fix eslint issues
1 parent ec60796 commit 9dbf588

20 files changed

+34
-46
lines changed

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
2+
"env": {
3+
"jest": true
4+
},
25
"parserOptions": {
36
"ecmaVersion": 6,
47
"sourceType": "module"
58
},
6-
"extends": ["prettier"],
9+
"extends": ["eslint-config-postcss", "prettier"],
710
"plugins": ["prettier"],
811
"rules": {
912
"prettier/prettier": [

__tests__/defineClass.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import postcss from 'postcss'
2-
import fs from 'fs'
3-
import _ from 'lodash'
41
import c from '../src/util/collapseWhitespace'
52
import defineClass from '../src/util/defineClass'
63

__tests__/defineClasses.test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import postcss from 'postcss'
2-
import fs from 'fs'
3-
import _ from 'lodash'
41
import c from '../src/util/collapseWhitespace'
52
import defineClasses from '../src/util/defineClasses'
63

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"babelify": "babel src --out-dir lib",
2121
"prepare": "npm run babelify && babel-node src/build.js",
2222
"watch": "nodemon -e js,css --watch src --exec 'babel-node src/build.js'",
23-
"test": "jest and eslint ."
23+
"style": "eslint .",
24+
"test": "jest && eslint ."
2425
},
2526
"devDependencies": {
2627
"autoprefixer": "^7.1.6",
@@ -33,6 +34,7 @@
3334
"babel-preset-stage-3": "^6.24.1",
3435
"clean-css": "^4.1.9",
3536
"eslint": "^4.10.0",
37+
"eslint-config-postcss": "^2.0.2",
3638
"eslint-config-prettier": "^2.7.0",
3739
"eslint-plugin-prettier": "^2.3.1",
3840
"jest": "^20.0.4",

src/build.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ function buildDistFile(filename) {
88
console.log(`Processing ./css/${filename}.css...`)
99

1010
fs.readFile(`./css/${filename}.css`, (err, css) => {
11+
if (err) throw err
12+
1113
return postcss([tailwind(), require('autoprefixer')])
1214
.process(css, {
1315
from: `./css/${filename}.css`,

src/cli.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
2+
/* eslint-disable no-process-exit */
23

3-
import fs from 'fs-extra'
4-
import _ from 'lodash'
54
import path from 'path'
5+
import fs from 'fs-extra'
6+
import tailwind from '..'
67
import postcss from 'postcss'
7-
import defaultConfig from '../defaultConfig'
8+
import process from 'process'
89
import program from 'commander'
9-
import tailwind from '..'
1010

1111
function loadConfig(configPath) {
1212
if (configPath === undefined) {
@@ -46,14 +46,14 @@ function buildTailwind(inputFile, config, write) {
4646
.catch(error => console.log(error))
4747
}
4848

49-
const packageJson = require(path.resolve(__dirname + '/../package.json'))
49+
const packageJson = require(path.resolve(__dirname, '/../package.json'))
5050

5151
program.version(packageJson.version).usage('<command> [<args>]')
5252

5353
program
5454
.command('init [filename]')
5555
.usage('[options] [filename]')
56-
.action(function(filename = 'tailwind.js') {
56+
.action((filename = 'tailwind.js') => {
5757
let destination = path.resolve(filename)
5858

5959
if (! path.extname(filename).includes('.js')) {
@@ -66,7 +66,7 @@ program
6666
}
6767

6868
const output = fs.readFileSync(
69-
path.resolve(__dirname + '/../defaultConfig.js'),
69+
path.resolve(__dirname, '/../defaultConfig.js'),
7070
'utf8'
7171
)
7272
fs.outputFileSync(
@@ -81,7 +81,7 @@ program
8181
.usage('[options] <file ...>')
8282
.option('-c, --config [path]', 'Path to config file')
8383
.option('-o, --output [path]', 'Output file')
84-
.action(function(file, options) {
84+
.action((file, options) => {
8585
let inputFile = program.args[0]
8686

8787
if (!inputFile) {
@@ -93,7 +93,7 @@ program
9393
inputFile,
9494
loadConfig(options.config),
9595
writeStrategy(options)
96-
).then(function() {
96+
).then(() => {
9797
process.exit()
9898
})
9999
})
@@ -102,7 +102,7 @@ program
102102
.command('*', null, {
103103
noHelp: true
104104
})
105-
.action(function() {
105+
.action(() => {
106106
program.help()
107107
})
108108

src/generators/borderWidths.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import _ from 'lodash'
2-
import defineClass from '../util/defineClass'
32
import defineClasses from '../util/defineClasses'
43

54
function defaultBorder(width, color) {
@@ -23,7 +22,7 @@ function defaultBorder(width, color) {
2322
}
2423

2524
function sizedBorder(size, width, color) {
26-
const style = width == 0 ? '0' : `${width} solid ${color}`
25+
const style = width == 0 ? '0' : `${width} solid ${color}` // eslint-disable-line eqeqeq
2726

2827
return defineClasses({
2928
[`border-${size}`]: {

src/generators/container.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-shadow */
12
import _ from 'lodash'
23
import postcss from 'postcss'
34
import defineClass from '../util/defineClass'

src/generators/textColors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function({ textColors }) {
66
return hoverable(
77
_.map(textColors, (color, modifier) => {
88
return defineClass(`text-${modifier}`, {
9-
color: color
9+
color
1010
})
1111
})
1212
)

src/generators/textStyle.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import _ from 'lodash'
21
import defineClasses from '../util/defineClasses'
32
import hoverable from '../util/hoverable'
43

0 commit comments

Comments
 (0)