Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps #170

Merged
merged 5 commits into from Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
@@ -1,10 +1,10 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: monthly
open-pull-requests-limit: 5
versioning-strategy: widen
labels:
- "pr: dependencies"
- 'pr: dependencies'
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Expand Up @@ -4,10 +4,10 @@ on:
push:
branches:
- master
- "dependabot/**"
- 'dependabot/**'
pull_request:
branches:
- "**"
- '**'

env:
CI: true
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2015 - present stylelint authors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
120 changes: 55 additions & 65 deletions __tests__/index.test.js
@@ -1,82 +1,72 @@
"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;
describe('flags no warnings with valid css', () => {
let result;

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

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

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

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

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

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

it("flags one warning", () => {
return result.then((data) =>
expect(data.results[0].warnings).toHaveLength(1)
);
});
it('flags one warning', () => {
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(
"Expected a leading zero (number-leading-zero)"
)
);
});
it('correct warning text', () => {
return result.then((data) =>
expect(data.results[0].warnings[0].text).toBe(
'Expected a leading zero (number-leading-zero)',
),
);
});

it("correct rule flagged", () => {
return result.then((data) =>
expect(data.results[0].warnings[0].rule).toBe("number-leading-zero")
);
});
it('correct rule flagged', () => {
return result.then((data) =>
expect(data.results[0].warnings[0].rule).toBe('number-leading-zero'),
);
});

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

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

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