Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,42 @@ on:
push:
branches:
- master
- "dependabot/**"
- 'dependabot/**'
pull_request:
branches:
- "**"
- '**'

env:
CI: true

jobs:
lint:
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 }}

Expand Down
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
*.pid
Copy link
Member

@jeddy3 jeddy3 Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a follow-up PR to move to a files: [] whitelisting approach.

*.seed
.editorconfig
.eslintignore
.eslintrc*
.git
.github
.gitignore
.grunt
.lock-wscript
.node_repl_history
.nyc_output
.prettierrc.js
.prettierignore
.stylelintrc*
.travis.yml
.vscode
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test/fixtures/*
coverage/**
.nyc_output/**
22 changes: 22 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer we use Prettier without any settings as we offload any decision making to that team (see version Prettier 2 changes) and I don't believe there's an easy way to share a Prettier config across repos, which means we have to keep them in sync manually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe there's an easy way to share a Prettier config across repos

Scratch that: https://prettier.io/docs/en/configuration.html#sharing-configurations

If the general consensus is to define our own settings then let's pull them out into @stylelint/prettier-config and roll them out across the org. We can do that in a follow-up pull request, one that probably uses remark-preset-lint-stylelint too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request pending at stylelint/prettier-config#1


// https://prettier.io/docs/en/options.html
module.exports = {
arrowParens: 'always',
endOfLine: 'lf',
printWidth: 100,
singleQuote: true,
useTabs: true,
overrides: [
{
files: ['package.json', 'package-lock.json', '*.md'],
options: {
printWidth: 80,
singleQuote: false,
tabWidth: 2,
trailingComma: 'none',
useTabs: false,
},
},
],
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const stylelint = require("stylelint");
const syntax = require("postcss-syntax");
postcss([stylelint({ fix: true })])
.process(source, { syntax: syntax })
.then(function(result) {
.then(function (result) {
// An alias for the result.css property. Use it with syntaxes that generate non-CSS output.
result.content;
});
Expand Down
21 changes: 8 additions & 13 deletions camel-case.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
"use strict";
function camelCase (str) {
return str.replace(/[\w-]+/g, (s) => (
'use strict';

function camelCase(str) {
return str.replace(/[\w-]+/g, (s) =>
/^-?[a-z]+(?:-[a-z]+)+$/.test(s)
? s.replace(
/^-(ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i,
"$1"
).replace(
/-\w/g,
s => (
s[1].toUpperCase()
)
)
? s
.replace(/^-(ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i, '$1')
.replace(/-\w/g, (s) => s[1].toUpperCase())
: s
));
);
}

module.exports = camelCase;
Loading