@jgarber/stylelint-config 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +10 -0
- package/.github/dependabot.yml +15 -0
- package/.github/workflows/ci.yml +27 -0
- package/.nvmrc +1 -0
- package/LICENSE +1 -1
- package/README.md +50 -1
- package/eslint.config.js +14 -0
- package/index.js +1 -5
- package/package.json +13 -8
- package/spec/indexSpec.js +22 -0
- package/spec/support/jasmine.json +14 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
updates:
|
|
4
|
+
- package-ecosystem: "github-actions"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
assignees:
|
|
9
|
+
- "jgarber623"
|
|
10
|
+
- package-ecosystem: "npm"
|
|
11
|
+
directory: "/"
|
|
12
|
+
schedule:
|
|
13
|
+
interval: "monthly"
|
|
14
|
+
assignees:
|
|
15
|
+
- "jgarber623"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
lint:
|
|
7
|
+
name: Lint files
|
|
8
|
+
runs-on: ubuntu-20.04
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v3
|
|
11
|
+
- uses: actions/setup-node@v3
|
|
12
|
+
with:
|
|
13
|
+
node-version-file: ".nvmrc"
|
|
14
|
+
cache: npm
|
|
15
|
+
- run: npm ci
|
|
16
|
+
- run: npm run lint
|
|
17
|
+
test:
|
|
18
|
+
name: Test files
|
|
19
|
+
runs-on: ubuntu-20.04
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version-file: ".nvmrc"
|
|
25
|
+
cache: npm
|
|
26
|
+
- run: npm ci
|
|
27
|
+
- run: npm test
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/*
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
1
|
# stylelint-config
|
|
2
2
|
|
|
3
|
-
Shareable [Stylelint](https://stylelint.io)
|
|
3
|
+
Shareable [Stylelint](https://stylelint.io) configuration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-dev @jgarber/stylelint-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Stylelint supports [a variety of configuration file formats](https://stylelint.io/user-guide/configure).
|
|
14
|
+
|
|
15
|
+
### YAML
|
|
16
|
+
|
|
17
|
+
In a file named `.stylelintrc` or `.stylelintrc.yml`:
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
---
|
|
21
|
+
extends: "@jgarber/stylelint-config"
|
|
22
|
+
---
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### JSON
|
|
26
|
+
|
|
27
|
+
In a file named `.stylelintrc` or `.stylelintrc.json`:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"extends": "@jgarber/stylelint-config"
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### JavaScript
|
|
36
|
+
|
|
37
|
+
In a JavaScript file using [CommonJS module](https://nodejs.org/api/modules.html) syntax:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
// stylelint.config.cjs
|
|
41
|
+
module.exports = require('@jgarber/stylelint-config');
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
In a JavaScript file using [ECMAScript module (ESM)](https://nodejs.org/api/esm.html) syntax:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
// stylelint.config.mjs
|
|
48
|
+
|
|
49
|
+
import config from '@jgarber/stylelint-config';
|
|
50
|
+
|
|
51
|
+
export default config;
|
|
52
|
+
```
|
package/eslint.config.js
ADDED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jgarber/stylelint-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shareable Stylelint
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Shareable Stylelint configuration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stylelint",
|
|
7
7
|
"stylelintconfig",
|
|
@@ -11,22 +11,27 @@
|
|
|
11
11
|
"bugs": "https://github.com/jgarber623/stylelint-config/issues",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"author": "Jason Garber <jason@sixtwothree.org> (https://sixtwothree.org)",
|
|
14
|
-
"files": [],
|
|
15
14
|
"main": "index.js",
|
|
16
15
|
"repository": "github:jgarber623/stylelint-config",
|
|
17
16
|
"scripts": {
|
|
18
|
-
"
|
|
17
|
+
"lint": "eslint .",
|
|
18
|
+
"test": "jasmine"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=16.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@jgarber/eslint-config": "
|
|
24
|
+
"@jgarber/eslint-config": "^1.1.0",
|
|
25
|
+
"globals": "^13.20.0",
|
|
26
|
+
"jasmine": "^5.0.2",
|
|
27
|
+
"stylelint": "^15.10.1",
|
|
28
|
+
"stylelint-config-standard": "^34.0.0",
|
|
29
|
+
"stylelint-order": "^6.0.3"
|
|
25
30
|
},
|
|
26
31
|
"peerDependencies": {
|
|
27
|
-
"stylelint": "
|
|
28
|
-
"stylelint-config-standard": "
|
|
29
|
-
"stylelint-order": "
|
|
32
|
+
"stylelint": ">=15.10.1",
|
|
33
|
+
"stylelint-config-standard": ">=34.0.0",
|
|
34
|
+
"stylelint-order": ">=6.0.3"
|
|
30
35
|
},
|
|
31
36
|
"publishConfig": {
|
|
32
37
|
"access": "public"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const stylelint = require('stylelint');
|
|
2
|
+
|
|
3
|
+
const config = require('../index');
|
|
4
|
+
|
|
5
|
+
it('exports an Object', () => {
|
|
6
|
+
expect(config).toEqual(jasmine.objectContaining({ extends: 'stylelint-config-standard' }));
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('loads the config and validates correct syntax', async () => {
|
|
10
|
+
const results = await stylelint.lint({ code: 'html { margin: 0 }', config });
|
|
11
|
+
|
|
12
|
+
expect(results.errored).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('loads the config and invalidates incorrect syntax', async () => {
|
|
16
|
+
const results = await stylelint.lint({ code: 'html { padding: 0; margin: 0 }', config });
|
|
17
|
+
|
|
18
|
+
const rules = results.results[0].warnings.map(({ rule }) => rule);
|
|
19
|
+
|
|
20
|
+
expect(results.errored).toBe(true);
|
|
21
|
+
expect(rules).toEqual(jasmine.arrayContaining(['declaration-block-single-line-max-declarations', 'order/properties-alphabetical-order']));
|
|
22
|
+
});
|