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

Remove syntax option #5297

Merged
merged 10 commits into from May 15, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/user-guide/usage/cli.md
Expand Up @@ -100,10 +100,6 @@ A filename to assign the input. More info about this option in [standard options

Accept stdin input even if it is empty.

### `--syntax, -s`

Specify a syntax. More info about this option in [standard options](options.md#syntax).

### `--version, -v`

Show the currently installed version of stylelint.
Expand Down
23 changes: 2 additions & 21 deletions docs/user-guide/usage/options.md
Expand Up @@ -87,36 +87,17 @@ If the number of warnings exceeds this value, the:
- CLI process exits with code `2`
- Node.js API adds a [`maxWarningsExceeded`](node-api.md#maxwarningsexceeded) property to the returned data

## `syntax`

CLI flags: `--syntax, -s`

Specify a syntax. Options:

- `css`
- `css-in-js`
- `html`
- `less`
- `markdown`
- `sass`
- `scss`
- `sugarss`

If you do not specify a syntax, stylelint will automatically infer the syntaxes.

Only use this option if you want to force a specific syntax.

## `customSyntax`

CLI flag: `--custom-syntax`

Specify a custom syntax to use on your code. Use this option if you want to force a specific syntax that's not already built into stylelint.
Specify a custom syntax to use on your code.

This option should be a string that resolves to a JS module that exports a [PostCSS-compatible syntax](https://github.com/postcss/postcss#syntaxes). The string can be a module name (like `my-module`) or a path to a JS file (like `path/to/my-module.js`).

Using the Node.js API, the `customSyntax` option can also accept a [Syntax object](https://github.com/postcss/postcss/blob/abfaa7122a0f480bc5be0905df3c24a6a51a82d9/lib/postcss.d.ts#L223-L232). Stylelint treats the `parse` property as a required value.

Note that stylelint can provide no guarantee that core rules work with syntaxes other than the defaults listed for the `syntax` option above.
Note that stylelint can provide no guarantee that core rules work with syntaxes.

## `disableDefaultIgnores`

Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/usage/postcss-plugin.md
Expand Up @@ -6,7 +6,7 @@ _However, if a dedicated stylelint task runner plugin [is available](../integrat

## Options

The PostCSS plugin uses the [standard options](options.md), _except the `syntax` and `customSyntax` options_. Instead, the syntax must be set within the [PostCSS options](https://github.com/postcss/postcss#options) as there can only be one parser/syntax in a pipeline.
The PostCSS plugin uses the [standard options](options.md), _except the `customSyntax` option_. Instead, the syntax must be set within the [PostCSS options](https://github.com/postcss/postcss#options) as there can only be one parser/syntax in a pipeline.

## Usage examples

Expand Down
7 changes: 0 additions & 7 deletions lib/__tests__/__snapshots__/cli.test.js.snap
Expand Up @@ -47,13 +47,6 @@ exports[`CLI --help 1`] = `

Pattern of files to ignore (in addition to those in .stylelintignore)

--syntax, -s

Specify a syntax. Options: \\"css\\", \\"css-in-js\\", \\"html\\", \\"less\\",
\\"markdown\\", \\"sass\\", \\"scss\\", \\"sugarss\\". If you do not specify a syntax,
syntaxes will be automatically inferred by the file extensions
and file content.

--fix

Automatically fix violations of certain rules.
Expand Down
19 changes: 0 additions & 19 deletions lib/__tests__/fixtures/extension-sensitive.html

This file was deleted.

4 changes: 0 additions & 4 deletions lib/__tests__/fixtures/extension-sensitive.less

This file was deleted.

3 changes: 0 additions & 3 deletions lib/__tests__/fixtures/extension-sensitive.sass

This file was deleted.

4 changes: 0 additions & 4 deletions lib/__tests__/fixtures/extension-sensitive.scss

This file was deleted.

4 changes: 0 additions & 4 deletions lib/__tests__/fixtures/extension-sensitive.sss

This file was deleted.

6 changes: 0 additions & 6 deletions lib/__tests__/fixtures/extension-sensitive.ts

This file was deleted.

5 changes: 0 additions & 5 deletions lib/__tests__/fixtures/html.js

This file was deleted.

13 changes: 0 additions & 13 deletions lib/__tests__/fixtures/style-tag.html

This file was deleted.

7 changes: 0 additions & 7 deletions lib/__tests__/fixtures/style-tag.markdown

This file was deleted.

13 changes: 0 additions & 13 deletions lib/__tests__/fixtures/style-tag.vue

This file was deleted.

17 changes: 0 additions & 17 deletions lib/__tests__/standalone-fix.test.js
Expand Up @@ -25,23 +25,6 @@ it('outputs fixed code when input is code string', async () => {
expect(result.output).toBe('a { color: red; }');
});

it('does not modify shorthand object syntax when autofixing', async () => {
const codeString = `const width = '100px'; const x = <div style={{width}}>Hi</div>`;

const result = await standalone({
code: codeString,
syntax: 'css-in-js',
config: {
rules: {
indentation: 2,
},
},
fix: true,
});

expect(result.output).toBe(codeString);
});

it('apply indentation autofix at last', async () => {
const result = await standalone({
code:
Expand Down