Permalink
Browse files

Update to ESLint 3.

Now that ESLint supports only Node versions > 0.12, we should
start to begin our transition to Node 4. Right now, this means
that we are dropping linting on 0.12 builds from Travis.
Furthermore, 0.12 is being dropped as a test environment from
Appveyor.

Module code for the 3.x releases will still continue to work
on 0.12 until the next major version.

Closes #216.
Closes #217.
Closes #218.
Closes #221.
Closes #222.
Closes #223.
Closes #224.
  • Loading branch information...
1 parent f29ab23 commit 945a6ff56fb49fd760b1d9bb6aa9ee9bf28db0e5 @ben-eb committed Jul 5, 2016
Showing with 387 additions and 378 deletions.
  1. +8 −4 .travis.yml
  2. +0 −1 appveyor.yml
  3. +6 −3 package.json
  4. +2 −2 src/__tests__/api.js
  5. +1 −1 src/__tests__/css.js
  6. +2 −2 src/__tests__/fixtures.js
  7. +3 −3 src/__tests__/integrations.js
  8. +3 −3 src/__tests__/issue26.js
  9. +2 −2 src/__tests__/modules.js
  10. +3 −3 src/__tests__/modules/autoprefixer.js
  11. +5 −5 src/__tests__/modules/cssnano-reduce-background-repeat.js
  12. +19 −19 src/__tests__/modules/cssnano-reduce-positions.js
  13. +5 −5 src/__tests__/modules/cssnano-reduce-timing-functions.js
  14. +14 −14 src/__tests__/modules/postcss-colormin.js
  15. +24 −24 src/__tests__/modules/postcss-convert-values.js
  16. +20 −20 src/__tests__/modules/postcss-discard-comments.js
  17. +11 −11 src/__tests__/modules/postcss-discard-duplicates.js
  18. +8 −8 src/__tests__/modules/postcss-discard-empty.js
  19. +2 −2 src/__tests__/modules/postcss-discard-overridden.js
  20. +9 −9 src/__tests__/modules/postcss-discard-unused.js
  21. +19 −19 src/__tests__/modules/postcss-font-family.js
  22. +6 −6 src/__tests__/modules/postcss-merge-idents.js
  23. +22 −22 src/__tests__/modules/postcss-merge-longhand.js
  24. +38 −38 src/__tests__/modules/postcss-merge-rules.js
  25. +3 −3 src/__tests__/modules/postcss-minify-font-weight.js
  26. +15 −15 src/__tests__/modules/postcss-minify-gradients.js
  27. +1 −1 src/__tests__/modules/postcss-minify-params.js
  28. +31 −31 src/__tests__/modules/postcss-minify-selectors.js
  29. +23 −23 src/__tests__/modules/postcss-normalize-url.js
  30. +12 −12 src/__tests__/modules/postcss-reduce-idents.js
  31. +16 −16 src/__tests__/modules/postcss-reduce-transforms.js
  32. +1 −1 src/__tests__/modules/postcss-svgo.js
  33. +9 −9 src/__tests__/modules/postcss-zindex.js
  34. +6 −6 src/__tests__/util/rebuild.js
  35. +5 −5 src/__tests__/warnOnce.js
  36. +26 −23 src/index.js
  37. +1 −1 src/lib/reduceBackgroundRepeat.js
  38. +4 −4 src/lib/reducePositions.js
  39. +1 −1 src/lib/reduceTimingFunctions.js
  40. +1 −1 src/lib/styleCache.js
View
@@ -1,10 +1,14 @@
sudo: false
language: node_js
-node_js:
- - '5'
- - '4'
- - '0.12'
+matrix:
+ include:
+ - node_js: '5'
+ - node_js: '4'
+ - node_js: '0.12'
+ env: NO_ESLINT=true
+
+script: "[[ $NO_ESLINT == true ]] && npm run test-012 || npm test"
after_success:
- './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls'
View
@@ -2,7 +2,6 @@ environment:
matrix:
- nodejs_version: '5'
- nodejs_version: '4'
- - nodejs_version: '0.12'
install:
- ps: Install-Product node $env:nodejs_version
View
@@ -9,7 +9,8 @@
"pretest": "eslint --ignore-path .gitignore src",
"prepublish": "del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
"report": "nyc report --reporter=html",
- "test": "nyc ava src/__tests__/*.js"
+ "test": "nyc ava src/__tests__/*.js",
+ "test-012": "nyc ava src/__tests__/*.js"
},
"keywords": [
"css",
@@ -68,8 +69,10 @@
"css-frameworks": "git+https://git@github.com/ben-eb/css-frameworks.git",
"css-minifier-tests": "git+https://git@github.com/ben-eb/css-minifier-tests.git",
"del-cli": "^0.2.0",
- "eslint": "^2.0.0",
- "eslint-config-cssnano": "^2.0.0",
+ "eslint": "^3.0.0",
+ "eslint-config-cssnano": "^3.0.0",
+ "eslint-plugin-babel": "^3.3.0",
+ "eslint-plugin-import": "^1.10.2",
"gh-pages": "^0.11.0",
"hook-std": "^0.2.0",
"json-loader": "^0.5.4",
@@ -1,10 +1,10 @@
+import {readFileSync as read} from 'fs';
import postcss from 'postcss';
import ava from 'ava';
import nano from '..';
-import specName from './util/specName';
-import {readFileSync as read} from 'fs';
import autoprefixer from 'autoprefixer';
import {name} from '../../package.json';
+import specName from './util/specName';
function pluginMacro (t, instance) {
const css = 'h1 { color: #ffffff }';
@@ -12,7 +12,7 @@ const minifiers = {
reject(err);
});
});
- }
+ },
};
const tests = directory(__dirname + '/../../node_modules/css-minifier-tests/tests').map(dir => {
@@ -1,8 +1,8 @@
+import {readdirSync as directory, readFileSync as file} from 'fs';
+import {join} from 'path';
import ava from 'ava';
import nano from '..';
-import {readdirSync as directory, readFileSync as file} from 'fs';
import specName from './util/specName';
-import {join} from 'path';
const base = join(__dirname, 'fixtures');
@@ -1,10 +1,10 @@
-import ava from 'ava';
-import nano from '..';
import {readFileSync as file} from 'fs';
import {join} from 'path';
+import ava from 'ava';
import postcss from 'postcss';
-import formatter from './util/formatter';
import frameworks from 'css-frameworks';
+import formatter from './util/formatter';
+import nano from '..';
const base = join(__dirname, 'integrations');
@@ -1,7 +1,7 @@
+import {join} from 'path';
+import {readFileSync as file} from 'fs';
import postcss from 'postcss';
import nano from '..';
-import {readFileSync as file} from 'fs';
-import {join} from 'path';
import ava from 'ava';
ava('it should compress whitespace after node.clone()', t => {
@@ -17,7 +17,7 @@ ava('it should compress whitespace after node.clone()', t => {
});
};
}),
- nano()
+ nano(),
]);
return processor.process(fixture).then(r => t.deepEqual(r.css, expected));
@@ -1,7 +1,7 @@
-import ava from 'ava';
+import {join} from 'path';
import {readdirSync as directory} from 'fs';
+import ava from 'ava';
import nano from '..';
-import {join} from 'path';
const base = join(__dirname, '/modules');
@@ -2,15 +2,15 @@ module.exports.name = 'autoprefixer';
module.exports.tests = [{
message: 'should remove outdated vendor prefixes',
fixture: 'h1{-webkit-box-sizing:content-box;box-sizing:content-box}',
- expected: 'h1{box-sizing:content-box}'
+ expected: 'h1{box-sizing:content-box}',
}, {
message: 'should not remove outdated vendor prefixes when minifying for older browsers',
fixture: 'h1{-webkit-box-sizing:content-box;box-sizing:content-box}',
expected: 'h1{-webkit-box-sizing:content-box;box-sizing:content-box}',
- options: {autoprefixer: {browsers: 'Safari < 5'}}
+ options: {autoprefixer: {browsers: 'Safari < 5'}},
}, {
message: 'should not remove outdated vendor prefixes if disabled',
fixture: 'h1{-webkit-box-sizing:content-box;box-sizing:content-box}',
expected: 'h1{-webkit-box-sizing:content-box;box-sizing:content-box}',
- options: {autoprefixer: false}
+ options: {autoprefixer: false},
}];
@@ -1,7 +1,7 @@
const tests = [{
message: 'should pass through two value syntax',
fixture: 'background:space round',
- expected: 'background:space round'
+ expected: 'background:space round',
}];
const mappings = {
@@ -17,19 +17,19 @@ Object.keys(mappings).forEach(mapping => {
tests.push({
message: `should handle ${mapping} (background)`,
fixture: `background:#000 url(cat.jpg) ${mappings[mapping]} 50%`,
- expected: `background:#000 url(cat.jpg) ${mapping} 50%`
+ expected: `background:#000 url(cat.jpg) ${mapping} 50%`,
}, {
message: `should handle ${mapping} (background-repeat)`,
fixture: `background-repeat:${mappings[mapping]}`,
- expected: `background-repeat:${mapping}`
+ expected: `background-repeat:${mapping}`,
}, {
message: `should handle multiple instances (background)`,
fixture: `background-repeat:#000 url(cat.jpg) ${mappings[mapping]} 50%,#000 url(cat.jpg) ${mappings[mapping]} 50%`,
- expected: `background-repeat:#000 url(cat.jpg) ${mapping} 50%,#000 url(cat.jpg) ${mapping} 50%`
+ expected: `background-repeat:#000 url(cat.jpg) ${mapping} 50%,#000 url(cat.jpg) ${mapping} 50%`,
}, {
message: `should handle multiple instances (background-repeat)`,
fixture: `background-repeat:${mappings[mapping]},${mappings[mapping]}`,
- expected: `background-repeat:${mapping},${mapping}`
+ expected: `background-repeat:${mapping},${mapping}`,
});
});
@@ -5,12 +5,12 @@ let tests = module.exports.tests = [];
const directions = ['top', 'right', 'bottom', 'left', 'center'];
const horizontal = {
right: '100%',
- left: '0'
+ left: '0',
};
const vertical = {
bottom: '100%',
- top: '0'
+ top: '0',
};
const hkeys = Object.keys(horizontal);
@@ -19,54 +19,54 @@ const vkeys = Object.keys(vertical);
const decls = [{
property: 'background:',
additional: 'url(http://example.com/testing/test.png) no-repeat ',
- tail: ' #fff'
+ tail: ' #fff',
}, {
property: 'background-position:',
additional: '',
- tail: ''
+ tail: '',
}, {
property: 'background:',
additional: '#000 url(cat.jpg) ',
- tail: ''
+ tail: '',
}, {
property: 'perspective-origin:',
additional: '',
- tail: ''
+ tail: '',
}, {
property: '-webkit-perspective-origin:',
additional: '',
- tail: ''
+ tail: '',
}];
decls.forEach(({additional, property, tail}) => {
const push = ({message, fixture, expected}) => {
tests.push({
message: message,
fixture: `${property}${additional}` + fixture + tail,
- expected: `${property}${additional}` + expected + tail
+ expected: `${property}${additional}` + expected + tail,
});
tests.push({
message: message + ' (with multiple arguments)',
fixture: `${property}${additional}${fixture}${tail}, ${fixture}${tail}`,
- expected: `${property}${additional}${expected}${tail},${expected}${tail}`
+ expected: `${property}${additional}${expected}${tail},${expected}${tail}`,
});
};
if (property === 'background:') {
push({
message: 'should convert <percentage> center/50% 50% to <percentage>/50% 50%',
fixture: '30% center/50% 50%',
- expected: '30%/50% 50%'
+ expected: '30%/50% 50%',
});
}
push({
message: 'should convert <percentage> center to <percentage>',
fixture: `30% center`,
- expected: `30%`
+ expected: `30%`,
});
push({
message: 'should not convert <percentage> <percentage>',
fixture: `45% 60%`,
- expected: `45% 60%`
+ expected: `45% 60%`,
});
directions.forEach(direction => {
let conversion = horizontal[direction] || direction;
@@ -77,27 +77,27 @@ decls.forEach(({additional, property, tail}) => {
push({
message: `should convert "${direction}" to "${conversion}"`,
fixture: `${direction}`,
- expected: `${conversion}`
+ expected: `${conversion}`,
});
}
push({
message: `should convert "${direction} center" to "${conversion}"`,
fixture: `${direction} center`,
- expected: `${conversion}`
+ expected: `${conversion}`,
});
if (direction === 'center') {
return;
}
push({
message: `should convert "center ${direction}" to "${conversion}"`,
fixture: `center ${direction}`,
- expected: `${conversion}`
+ expected: `${conversion}`,
});
directions.slice(0, -1).filter(d => {
if (
d === direction ||
(~hkeys.indexOf(d) && ~hkeys.indexOf(direction)) ||
- (~vkeys.indexOf(d) && ~vkeys.indexOf(direction))
+ (~vkeys.indexOf(d) && ~vkeys.indexOf(direction))
) {
return false;
}
@@ -112,18 +112,18 @@ decls.forEach(({additional, property, tail}) => {
push({
message: `should convert "${direction} ${other}" to "${result}"`,
fixture: `${direction} ${other}`,
- expected: `${result}`
+ expected: `${result}`,
});
push({
message: `should not convert the three value syntax "${direction} ${other} 60px"`,
fixture: `${direction} ${other} 60px`,
- expected: `${direction} ${other} 60px`
+ expected: `${direction} ${other} 60px`,
});
if (property === 'background:') {
push({
message: `should convert "${direction} ${other}"/50% 50% to "${result}/50% 50%"`,
fixture: `${direction} ${other}/50% 50%`,
- expected: `${result}/50% 50%`
+ expected: `${result}/50% 50%`,
});
}
});
@@ -11,26 +11,26 @@ const mappings = {
'steps(5,start)': 'steps(5, start)',
'steps(10)': 'steps(10, end)',
'steps(15)': 'steps(15)',
- 'var(--anim1)': 'var(--anim1)'
+ 'var(--anim1)': 'var(--anim1)',
};
Object.keys(mappings).forEach(mapping => {
tests.push({
message: `should handle ${mapping} (animation)`,
fixture: `animation:fade 3s ${mappings[mapping]}`,
- expected: `animation:fade 3s ${mapping}`
+ expected: `animation:fade 3s ${mapping}`,
}, {
message: `should handle ${mapping} (animation-timing-function)`,
fixture: `animation-timing-function:${mappings[mapping]}`,
- expected: `animation-timing-function:${mapping}`
+ expected: `animation-timing-function:${mapping}`,
}, {
message: `should handle ${mapping} (transition)`,
fixture: `transition:color 3s ${mappings[mapping]}`,
- expected: `transition:color 3s ${mapping}`
+ expected: `transition:color 3s ${mapping}`,
}, {
message: `should handle ${mapping} (transition-timing-function)`,
fixture: `transition-timing-function:${mappings[mapping]}`,
- expected: `transition-timing-function:${mapping}`
+ expected: `transition-timing-function:${mapping}`,
});
});
Oops, something went wrong.

0 comments on commit 945a6ff

Please sign in to comment.