Skip to content

Commit

Permalink
Use standard stylelint tooling (#59)
Browse files Browse the repository at this point in the history
* Use standard stylelint tooling

* Ignore ESLint cache

* Add remark-preset-prettier
  • Loading branch information
jeddy3 authored Apr 1, 2020
1 parent 3abd3c1 commit 4966503
Show file tree
Hide file tree
Showing 12 changed files with 12,293 additions and 119 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches:
- master
- "dependabot/**"
pull_request:
branches:
- "**"

env:
CI: true

jobs:
pretest:
name: Lint on Node.js ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [12]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install latest npm
run: npm install --global npm@latest

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

test:
name: Test on Node.js ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [10, 12]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: Install latest npm
run: npm install --global npm@latest

- name: Install dependencies
run: npm ci

- name: Test
run: npm test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
package-lock.json
.eslintcache
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
package-lock=false
tag-version-prefix = ""
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

26 changes: 13 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# 3.0.0

- Added: `function-calc-no-invalid` rule.
- Removed: `stylelint` < 10.1.0 from peer dependencies. `[email protected]+` is required now.
- Added: `function-calc-no-invalid` rule.
- Removed: `stylelint` < 10.1.0 from peer dependencies. `[email protected]+` is required now.

# 2.2.0

- Added: `stylelint@10` to peer dependency range.
- Added: `stylelint@10` to peer dependency range.

# 2.1.0

- Added: `stylelint@9` to peer dependency range.
- Added: `stylelint@9` to peer dependency range.

# 2.0.1

- Removed: `declaration-block-no-redundant-longhand-properties` rule. This time it is actually removed.
- Removed: `declaration-block-no-redundant-longhand-properties` rule. This time it is actually removed.

# 2.0.0

- Removed: `declaration-block-no-redundant-longhand-properties` rule.
- Removed: `shorthand-property-no-redundant-values` rule.
- Added: `font-family-no-missing-generic-family-keyword` rule.
- Added: `no-descending-specificity` rule.
- Added: `no-duplicate-at-import-rules` rule.
- Added: `no-duplicate-selectors` rule.
- Removed: `declaration-block-no-redundant-longhand-properties` rule.
- Removed: `shorthand-property-no-redundant-values` rule.
- Added: `font-family-no-missing-generic-family-keyword` rule.
- Added: `no-descending-specificity` rule.
- Added: `no-duplicate-at-import-rules` rule.
- Added: `no-duplicate-selectors` rule.

# 1.0.0

- Use `stylelint@8`.
- Use `stylelint@8`.

# 0.1.0

- Initial release
- Initial release
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 stylelint
Copyright (c) 2017-present stylelint

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# stylelint-config-recommended

[![NPM version](http://img.shields.io/npm/v/stylelint-config-recommended.svg)](https://www.npmjs.org/package/stylelint-config-recommended) [![Build Status](https://travis-ci.com/stylelint/stylelint-config-recommended.svg?branch=master)](https://travis-ci.com/stylelint/stylelint-config-recommended) [![Build status](https://ci.appveyor.com/api/projects/status/b63jx3nxiegbcbt2/branch/master?svg=true)](https://ci.appveyor.com/project/stylelint/stylelint-config-recommended/branch/master)
[![NPM version](https://img.shields.io/npm/v/stylelint-config-recommended.svg)](https://www.npmjs.org/package/stylelint-config-recommended) [![Build Status](https://github.com/stylelint/stylelint-config-recommended/workflows/CI/badge.svg)](https://github.com/stylelint/stylelint-config-recommended/actions)

> The recommended shareable config for stylelint.
Expand Down Expand Up @@ -50,11 +50,12 @@ For example, to change the `at-rule-no-unknown` rule to use its `ignoreAtRules`
{
"extends": "stylelint-config-recommended",
"rules": {
"at-rule-no-unknown": [ true, {
"ignoreAtRules": [
"extends"
]
}],
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["extends"]
}
],
"block-no-empty": null,
"unit-whitelist": ["em", "rem", "s"]
}
Expand Down
86 changes: 42 additions & 44 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,82 @@
"use strict"
"use strict";

const config = require("../")
const fs = require("fs")
const stylelint = require("stylelint")
const config = require("../");
const fs = require("fs");
const stylelint = require("stylelint");

const validCss = fs.readFileSync("./__tests__/css-valid.css", "utf-8")
const invalidCss = fs.readFileSync("./__tests__/css-invalid.css", "utf-8")
const validCss = fs.readFileSync("./__tests__/css-valid.css", "utf-8");
const invalidCss = fs.readFileSync("./__tests__/css-invalid.css", "utf-8");

describe("flags no warnings with valid css", () => {
let result
let result;

beforeEach(() => {
result = stylelint.lint({
code: validCss,
config,
})
})
});
});

it("did not error", () => {
return result.then(data => (
expect(data.errored).toBeFalsy()
))
})
return result.then((data) => expect(data.errored).toBeFalsy());
});

it("flags no warnings", () => {
return result.then(data => (
return result.then((data) =>
expect(data.results[0].warnings).toHaveLength(0)
))
})
})
);
});
});

describe("flags warnings with invalid css", () => {
let result
let result;

beforeEach(() => {
result = stylelint.lint({
code: invalidCss,
config,
})
})
});
});

it("did error", () => {
return result.then(data => (
expect(data.errored).toBeTruthy()
))
})
return result.then((data) => expect(data.errored).toBeTruthy());
});

it("flags one warning", () => {
return result.then(data => (
return result.then((data) =>
expect(data.results[0].warnings).toHaveLength(1)
))
})
);
});

it("correct warning text", () => {
return result.then(data => (
expect(data.results[0].warnings[0].text).toBe("Unexpected unknown type selector \"madeup\" (selector-type-no-unknown)")
))
})
return result.then((data) =>
expect(data.results[0].warnings[0].text).toBe(
'Unexpected unknown type selector "madeup" (selector-type-no-unknown)'
)
);
});

it("correct rule flagged", () => {
return result.then(data => (
return result.then((data) =>
expect(data.results[0].warnings[0].rule).toBe("selector-type-no-unknown")
))
})
);
});

it("correct severity flagged", () => {
return result.then(data => (
return result.then((data) =>
expect(data.results[0].warnings[0].severity).toBe("error")
))
})
);
});

it("correct line number", () => {
return result.then(data => (
return result.then((data) =>
expect(data.results[0].warnings[0].line).toBe(1)
))
})
);
});

it("correct column number", () => {
return result.then(data => (
return result.then((data) =>
expect(data.results[0].warnings[0].column).toBe(1)
))
})
})
);
});
});
22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = {
"declaration-block-no-duplicate-properties": [
true,
{
ignore: ["consecutive-duplicates-with-different-values"]
}
ignore: ["consecutive-duplicates-with-different-values"],
},
],
"declaration-block-no-shorthand-property-overrides": true,
"font-family-no-duplicate-names": true,
Expand All @@ -31,6 +31,6 @@ module.exports = {
"selector-pseudo-element-no-unknown": true,
"selector-type-no-unknown": true,
"string-no-newline": true,
"unit-no-unknown": true
}
"unit-no-unknown": true,
},
};
Loading

0 comments on commit 4966503

Please sign in to comment.