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 #6420

Merged
merged 7 commits into from Oct 25, 2022

Conversation

fpetrakov
Copy link
Contributor

Which issue, if any, is this issue related to?

Closes #6414.

Is there anything in the PR that needs further explanation?

No, it's self-explanatory.

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2022

🦋 Changeset detected

Latest commit: 87c9bea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
stylelint Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@fpetrakov
Copy link
Contributor Author

fpetrakov commented Oct 22, 2022

Is it everything I should have done? I guess, no

@fpetrakov
Copy link
Contributor Author

I will need some help as I haven't worked with these parts of the codebase yet.

Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

@fpetrakov Thanks for working on the issue. This change should be a breaking change, so could you please change the base branch from main to v15 (I've just created it)? See also #6409.

@jeddy3 jeddy3 changed the title remove syntax option as it's deprecated Remove syntax option Oct 22, 2022
@fpetrakov fpetrakov changed the base branch from main to v15 October 22, 2022 12:38
@ybiquitous
Copy link
Member

@fpetrakov Let's fix all type errors caused by removing syntax from the LinterOptions type.

Also, we need to remove the code about syntax from cli.js. For example:

stylelint/lib/cli.js

Lines 332 to 335 in e3585ed

syntax: {
alias: 's',
type: 'string',
},

It also looks like the following code could be removed (there may be more):

syntax?: string;

@fpetrakov
Copy link
Contributor Author

@ybiquitous Thanks for the detailed explanation. I will work on this issue ASAP 🚀

@fpetrakov
Copy link
Contributor Author

it('rejects on syntax option', async () => {
await expect(
standalone({
syntax: 'scss',
code: '',
config: { rules: { 'block-no-empty': true } },
}),
).rejects.toThrow(
'The "syntax" option is no longer available. You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option',
);
});
it('rejects when customSyntax and syntax are set', async () => {
const config = {
rules: {
'block-no-empty': true,
},
};
await expect(
standalone({
config,
syntax: 'less',
customSyntax: `${fixturesPath}/custom-syntax`,
code: '$foo: bar; // foo;\nb {}',
formatter: stringFormatter,
}),
).rejects.toThrow(
'The "syntax" option is no longer available. You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option',
);
});

Should I remove these 2 tests?

@fpetrakov
Copy link
Contributor Author

I've also found these:

* @property {string} [syntax]

* @property {string} [syntax]

stylelint/lib/cli.js

Lines 332 to 335 in e3585ed

syntax: {
alias: 's',
type: 'string',
},

stylelint/lib/cli.js

Lines 374 to 376 in e3585ed

if (cli.flags.syntax) {
optionsBase.syntax = cli.flags.syntax;
}

Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Thanks, all the changes look good! Is it possible to remove also syntax occurrences in the type definition?

syntax?: string;

export type PostcssPluginOptions = Omit<LinterOptions, 'syntax' | 'customSyntax'> | Config;

@ybiquitous
Copy link
Member

Could you add a changelog entry with the following content via npx changeset add (major)?

Removed: `syntax` option

Copy link
Member

@ybiquitous ybiquitous left a comment

Choose a reason for hiding this comment

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

Thank you! LGTM 👍🏼

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@ybiquitous ybiquitous merged commit a56b8c7 into stylelint:v15 Oct 25, 2022
@fpetrakov fpetrakov deleted the remove-deprecated-syntax-option branch October 25, 2022 07:41
ybiquitous pushed a commit that referenced this pull request Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Remove deprecated syntax option
3 participants