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

Change target-branch for Dependabot #6439

Closed
wants to merge 13 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/grumpy-scissors-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": major
---

Change: `extends` in `overrides` to merge to be consistent with `plugins` behaviour
5 changes: 5 additions & 0 deletions .changeset/nervous-insects-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": major
---

Removed: `syntax` option
5 changes: 5 additions & 0 deletions .changeset/selfish-years-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `unit-no-unknown` false positives for `*vi` & `*vb` viewport units
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ updates:
labels:
- 'pr: dependencies'
versioning-strategy: increase
target-branch: v15 # TODO: We should remove this line after shipping v15.

- package-ecosystem: github-actions
directory: '/'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/code-scanning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- '!dependabot/**'
- v15 # TODO: We can remove this line after shipping v15.
pull_request:
# The branches below must be a subset of the branches above
branches:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/releasing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- v15 # TODO: We can remove this line after shipping v15.

permissions:
contents: write
Expand Down Expand Up @@ -39,8 +40,8 @@ jobs:
- name: Create release pull request
uses: changesets/action@v1
with:
commit: Prepare release
title: Prepare release
commit: Prepare release 15.0.0
title: Prepare release 15.0.0
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
# We're also restoring `package.json` because we're using `np` for publishing
version: npm run version
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- 'dependabot/**'
- v15 # TODO: We can remove this line after shipping v15.
pull_request:
branches:
- '**'
Expand All @@ -26,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [12, 14, 16, 18]
node: [14, 16, 18]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand All @@ -46,14 +47,14 @@ jobs:

- name: Test
run: npm run jest
if: "!(startsWith(matrix.os, 'ubuntu') && matrix.node == 16)"
if: "!(startsWith(matrix.os, 'ubuntu') && matrix.node == 18)"

- name: Test with coverage
run: npm run jest -- --coverage
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 16
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 18

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 16
if: startsWith(matrix.os, 'ubuntu') && matrix.node == 18
with:
files: ./.coverage/lcov.info
23 changes: 23 additions & 0 deletions docs/migration-guide/to-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Migrating to 15.0.0

## Change of `overrides.extends` behavior

We changed the `overrides.extends` behavior to merge rather than replace, to make it consistent with the `overrides.plugins`.

If you would like to keep the previous behavior, you should change your config to:

```diff json
{
- "extends": ["config-a"],
"overrides": [
{
"rules": ["*.module.css"],
"extends": ["config-b"]
},
+ {
+ "rules": ["*.css"],
+ "extends": ["config-a"]
+ }
]
}
```
2 changes: 2 additions & 0 deletions docs/user-guide/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ Here is how overrides work in a configuration file:
- Glob pattern overrides have higher precedence than the regular configuration in the same config file. Multiple overrides within the same config are applied in order. That is, the last override block in a config file always has the highest precedence.
- A glob specific configuration works almost the same as any other Stylelint config. Override blocks can contain any configuration options that are valid in a regular config.
- Multiple glob patterns can be provided within a single override block. A file must match at least one of the supplied patterns for the configuration to apply.
- `customSyntax` will be replaced by overrides.
- `plugins`, `extends`, `rules`, etc. will be appended.

## `defaultSeverity`

Expand Down
75 changes: 73 additions & 2 deletions docs/user-guide/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,97 @@ In addition to rule problems, Stylelint surfaces the following errors and warnin

## CSS syntax error

The chosen [PostCSS syntax](usage/options.md#customsyntax) was unable to parse the source.
The CSS parser built into Stylelint, or the chosen [custom syntax](usage/options.md#customsyntax), could not parse your code.

### Unclosed block

You should balance your _curly braces_, typically of _declaration blocks_.

For example:

```diff css
- a { color: red;
+ a { color: red; }
```

### Unclosed bracket

You should balance your _square brackets_, typically of _attribute selectors_ and _grid names_.

For example:

```diff css
- a[foo { grid: [bar; }
+ a[foo] { grid: [bar]; }
```

### Unclosed string

You should balance your _quotation marks_.

For example:

```diff css
- a { content: " }
+ a { content: "" }
```

### Unknown word

You should:

- hyphenate _properties_
- separate _property and value pairs_ with _colons_
- separate _declarations_ with _semicolons_
- pair _selectors_ with _declaration blocks_ in _rules_

For example:

```diff css
a {
- margin top: 1px
- color red
+ margin-top: 1px;
+ color: red
}
```

## Parse error

The chosen [PostCSS syntax](usage/options.md#customsyntax) successfully parsed, but one of the construct-specific parsers failed to parse either a media query, selector or value within that source.
The CSS parser built into Stylelint (or the chosen [custom syntax](usage/options.md#customsyntax)) successfully parsed your code, but one of the construct-specific parsers failed to parse either a media query, selector or value within that source.

The construct-specific parsers are:

- `postcss-media-query-parser`
- `postcss-selector-parser`
- `postcss-value-parser`

You should check that your constructs are wellformed, e.g. parentheses are balanced.

## Unknown rule error

There is an unknown rule in the [configuration object](configure.md).

You should:

- install the latest version of Stylelint (`npm i --save-dev stylelint`), as we may have recently added the rule
- check that the rule exists and is correctly named by searching the [list of rules](rules.md)

## Deprecation warning

There is a deprecated rule in the [configuration object](configure.md).

You should:

- identify in the [CHANGELOG](../../CHANGELOG.md) which release deprecated the rule
- take the action suggested there

## Invalid option warning

There is a misconfigured rule in the [configuration object](configure.md).

You should:

- install the latest version of Stylelint (`npm i --save-dev stylelint`), as we may have recently added the option
- check that the option exists and is correctly named by reading the rule's README
- correctly configure the [`rules`](configure.md#rules) property in the configuration object
30 changes: 15 additions & 15 deletions lib/__tests__/__snapshots__/cli.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ exports[`CLI --help 1`] = `

--config-basedir

An absolute path to the directory that relative paths defining \\"extends\\"
and \\"plugins\\" are *relative to*. Only necessary if these values are
An absolute path to the directory that relative paths defining "extends"
and "plugins" are *relative to*. Only necessary if these values are
relative paths.

--print-config
Expand Down Expand Up @@ -76,31 +76,31 @@ exports[`CLI --help 1`] = `

Store the info about processed files in order to only operate on the
changed ones the next time you run stylelint. By default, the cache
is stored in \\"./.stylelintcache\\". To adjust this, use --cache-location.
is stored in "./.stylelintcache". To adjust this, use --cache-location.

--cache-location [default: '.stylelintcache']

Path to a file or directory to be used for the cache location.
Default is \\"./.stylelintcache\\". If a directory is specified, a cache
Default is "./.stylelintcache". If a directory is specified, a cache
file will be created inside the specified folder, with a name derived
from a hash of the current working directory.

If the directory for the cache does not exist, make sure you add a trailing \\"/\\"
on *nix systems or \\"\\\\\\" on Windows. Otherwise the path will be assumed to be a file.
If the directory for the cache does not exist, make sure you add a trailing "/"
on *nix systems or "\\" on Windows. Otherwise the path will be assumed to be a file.

--cache-strategy [default: \\"metadata\\"]
--cache-strategy [default: "metadata"]

Strategy for the cache to use for detecting changed files. Can be either
\\"metadata\\" or \\"content\\".
"metadata" or "content".

The \\"content\\" strategy can be useful in cases where the modification time of
The "content" strategy can be useful in cases where the modification time of
your files changes even if their contents have not. For example, this can happen
during git operations like \\"git clone\\" because git does not track file modification
during git operations like "git clone" because git does not track file modification
time.

--formatter, -f [default: \\"string\\"]
--formatter, -f [default: "string"]

The output formatter: \\"compact\\", \\"github\\", \\"json\\", \\"string\\", \\"tap\\", \\"unix\\" or \\"verbose\\".
The output formatter: "compact", "github", "json", "string", "tap", "unix" or "verbose".

--custom-formatter

Expand All @@ -109,8 +109,8 @@ exports[`CLI --help 1`] = `

--quiet, -q

Only register problems for rules with an \\"error\\"-level severity (ignore
\\"warning\\"-level).
Only register problems for rules with an "error"-level severity (ignore
"warning"-level).

--color
--no-color
Expand All @@ -135,7 +135,7 @@ exports[`CLI --help 1`] = `
--max-warnings, --mw

Number of warnings above which the process will exit with code 2.
Useful when setting \\"defaultSeverity\\" to \\"warning\\" and expecting the
Useful when setting "defaultSeverity" to "warning" and expecting the
process to fail on warnings (e.g. CI build).

--output-file, -o
Expand Down
43 changes: 41 additions & 2 deletions lib/__tests__/applyOverrides.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,45 @@ describe('two matching overrides', () => {

expect(applied).toEqual(expectedConfig);
});

test('with extends', () => {
const config = {
extends: ['stylelint-config1'],
rules: {
'block-no-empty': true,
'unit-disallowed-list': ['px'],
},
overrides: [
{
files: ['*.module.css'],
extends: ['stylelint-config2'],
rules: {
'color-no-hex': true,
},
},
{
files: ['*.css'],
extends: ['stylelint-config3'],
rules: {
'block-no-empty': null,
},
},
],
};

const expectedConfig = {
extends: ['stylelint-config1', 'stylelint-config2', 'stylelint-config3'],
rules: {
'block-no-empty': null,
'unit-disallowed-list': ['px'],
'color-no-hex': true,
},
};

const applied = applyOverrides(config, __dirname, path.join(__dirname, 'style.module.css'));

expect(applied).toEqual(expectedConfig);
});
});

describe('no matching overrides', () => {
Expand Down Expand Up @@ -273,7 +312,7 @@ test('overrides is not an array', () => {
expect(() => {
applyOverrides(config, __dirname, path.join(__dirname, 'style.module.css'));
}).toThrowErrorMatchingInlineSnapshot(
`"The \`overrides\` configuration property should be an array, e.g. { \\"overrides\\": [{ \\"files\\": \\"*.css\\", \\"rules\\": {} }] }."`,
`"The \`overrides\` configuration property should be an array, e.g. { "overrides": [{ "files": "*.css", "rules": {} }] }."`,
);
});

Expand All @@ -294,7 +333,7 @@ test('`files` is missing', () => {
expect(() => {
applyOverrides(config, __dirname, path.join(__dirname, 'style.module.css'));
}).toThrowErrorMatchingInlineSnapshot(
`"Every object in the \`overrides\` configuration property should have a \`files\` property with globs, e.g. { \\"overrides\\": [{ \\"files\\": \\"*.css\\", \\"rules\\": {} }] }."`,
`"Every object in the \`overrides\` configuration property should have a \`files\` property with globs, e.g. { "overrides": [{ "files": "*.css", "rules": {} }] }."`,
);
});

Expand Down
5 changes: 0 additions & 5 deletions lib/__tests__/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ describe('buildCLI', () => {
expect(buildCLI(['--stdin-filename=foo.css']).flags.stdinFilename).toBe('foo.css');
});

it('flags.syntax', () => {
expect(buildCLI(['--syntax=less']).flags.syntax).toBe('less');
expect(buildCLI(['-s', 'less']).flags.syntax).toBe('less');
});

it('flags.version', () => {
expect(buildCLI(['--version']).flags.version).toBe(true);
expect(buildCLI(['-v']).flags.version).toBe(true);
Expand Down
Loading