@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 ADDED
@@ -0,0 +1,10 @@
1
+ # EditorConfig is awesome: https://EditorConfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ indent_size = 2
9
+ indent_style = space
10
+ trim_trailing_whitespace = true
@@ -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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Jason Garber
3
+ Copyright (c) 2022–present Jason Garber
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,3 +1,52 @@
1
1
  # stylelint-config
2
2
 
3
- Shareable [Stylelint](https://stylelint.io) configurations.
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
+ ```
@@ -0,0 +1,14 @@
1
+ const config = require('@jgarber/eslint-config');
2
+ const globals = require('globals');
3
+
4
+ module.exports = [
5
+ ...config,
6
+ {
7
+ files: ['spec/**/*[sS]pec.?(m)js'],
8
+ languageOptions: {
9
+ globals: {
10
+ ...globals.jasmine
11
+ }
12
+ }
13
+ }
14
+ ];
package/index.js CHANGED
@@ -1,10 +1,6 @@
1
1
  module.exports = {
2
2
  extends: 'stylelint-config-standard',
3
-
4
- plugins: [
5
- 'stylelint-order'
6
- ],
7
-
3
+ plugins: ['stylelint-order'],
8
4
  rules: {
9
5
  'order/properties-alphabetical-order': true
10
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jgarber/stylelint-config",
3
- "version": "0.2.0",
4
- "description": "Shareable Stylelint configurations.",
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
- "test": "eslint ."
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": "^14.6.1",
28
- "stylelint-config-standard": "^25.0.0",
29
- "stylelint-order": "^5.0.0"
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
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "spec_dir": "spec",
3
+ "spec_files": [
4
+ "**/*[sS]pec.?(m)js"
5
+ ],
6
+ "helpers": [
7
+ "helpers/**/*.?(m)js"
8
+ ],
9
+ "env": {
10
+ "failSpecWithNoExpectations": true,
11
+ "random": true,
12
+ "stopSpecOnExpectationFailure": false
13
+ }
14
+ }