Skip to content

Commit 6f3f310

Browse files
authored
Merge pull request stylelint#27 from stylelint/lint
Use ESLint and Prettier
2 parents e634d36 + 5aa3b35 commit 6f3f310

37 files changed

+2137
-768
lines changed

.github/workflows/nodejs.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,42 @@ on:
44
push:
55
branches:
66
- master
7-
- "dependabot/**"
7+
- 'dependabot/**'
88
pull_request:
99
branches:
10-
- "**"
10+
- '**'
1111

1212
env:
1313
CI: true
1414

1515
jobs:
16+
lint:
17+
name: Lint on Node.js ${{ matrix.node }} and ${{ matrix.os }}
18+
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
matrix:
23+
node: [12]
24+
os: [ubuntu-latest]
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Use Node.js ${{ matrix.node }}
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ matrix.node }}
33+
34+
- name: Install latest npm
35+
run: npm install --global npm@latest
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Lint
41+
run: npm run lint
42+
1643
test:
1744
name: Test on Node.js ${{ matrix.node }}
1845

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
*.pid
33
*.seed
44
.editorconfig
5+
.eslintignore
56
.eslintrc*
67
.git
8+
.github
79
.gitignore
810
.grunt
911
.lock-wscript
1012
.node_repl_history
1113
.nyc_output
14+
.prettierrc.js
15+
.prettierignore
1216
.stylelintrc*
1317
.travis.yml
1418
.vscode

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test/fixtures/*
2+
coverage/**
3+
.nyc_output/**

.prettierrc.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
// https://prettier.io/docs/en/options.html
4+
module.exports = {
5+
arrowParens: 'always',
6+
endOfLine: 'lf',
7+
printWidth: 100,
8+
singleQuote: true,
9+
useTabs: true,
10+
overrides: [
11+
{
12+
files: ['package.json', 'package-lock.json', '*.md'],
13+
options: {
14+
printWidth: 80,
15+
singleQuote: false,
16+
tabWidth: 2,
17+
trailingComma: 'none',
18+
useTabs: false,
19+
},
20+
},
21+
],
22+
};

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const stylelint = require("stylelint");
4545
const syntax = require("postcss-syntax");
4646
postcss([stylelint({ fix: true })])
4747
.process(source, { syntax: syntax })
48-
.then(function(result) {
48+
.then(function (result) {
4949
// An alias for the result.css property. Use it with syntaxes that generate non-CSS output.
5050
result.content;
5151
});

camel-case.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
"use strict";
2-
function camelCase (str) {
3-
return str.replace(/[\w-]+/g, (s) => (
1+
'use strict';
2+
3+
function camelCase(str) {
4+
return str.replace(/[\w-]+/g, (s) =>
45
/^-?[a-z]+(?:-[a-z]+)+$/.test(s)
5-
? s.replace(
6-
/^-(ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i,
7-
"$1"
8-
).replace(
9-
/-\w/g,
10-
s => (
11-
s[1].toUpperCase()
12-
)
13-
)
6+
? s
7+
.replace(/^-(ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i, '$1')
8+
.replace(/-\w/g, (s) => s[1].toUpperCase())
149
: s
15-
));
10+
);
1611
}
1712

1813
module.exports = camelCase;

0 commit comments

Comments
 (0)