From dffc1386e63b2dc225122a14703112fbd245c6d8 Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Sat, 22 Oct 2022 14:26:28 +0300 Subject: [PATCH 1/7] remove syntax option as it's deprecated --- types/stylelint/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts index b3b10781ff..ae092934c0 100644 --- a/types/stylelint/index.d.ts +++ b/types/stylelint/index.d.ts @@ -240,8 +240,6 @@ declare module 'stylelint' { reportNeedlessDisables?: boolean; reportInvalidScopeDisables?: boolean; maxWarnings?: number; - /** @deprecated Use `customSyntax` instead. Using this option will result in an error. */ - syntax?: string; customSyntax?: CustomSyntax; formatter?: FormatterType | Formatter; disableDefaultIgnores?: boolean; From 6cfc0ee9cfa5b84959327dd6b0da19ca373a097e Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Sun, 23 Oct 2022 11:22:59 +0300 Subject: [PATCH 2/7] remove syntax option from places where lint throws errors --- lib/getPostcssResult.js | 11 ----------- lib/standalone.js | 2 -- types/stylelint/type-test.ts | 1 - 3 files changed, 14 deletions(-) diff --git a/lib/getPostcssResult.js b/lib/getPostcssResult.js index 4b00c5aa87..63ce9e8959 100644 --- a/lib/getPostcssResult.js +++ b/lib/getPostcssResult.js @@ -26,17 +26,6 @@ module.exports = async function getPostcssResult(stylelint, options = {}) { return cached; } - if (stylelint._options.syntax) { - let error = 'The "syntax" option is no longer available. '; - - error += - stylelint._options.syntax === 'css' - ? 'You can remove the "--syntax" CLI flag as stylelint will now parse files as CSS by default' - : `You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option`; - - return Promise.reject(new Error(error)); - } - const syntax = options.customSyntax ? getCustomSyntax(options.customSyntax) : cssSyntax(stylelint, options.filePath); diff --git a/lib/standalone.js b/lib/standalone.js index 1848dae2a7..e365e47ba6 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -58,7 +58,6 @@ async function standalone({ reportDescriptionlessDisables, reportInvalidScopeDisables, reportNeedlessDisables, - syntax, }) { const startTime = Date.now(); @@ -103,7 +102,6 @@ async function standalone({ reportNeedlessDisables, reportInvalidScopeDisables, reportDescriptionlessDisables, - syntax, customSyntax, fix, quiet, diff --git a/types/stylelint/type-test.ts b/types/stylelint/type-test.ts index 6b3184ee30..d964f37fdd 100644 --- a/types/stylelint/type-test.ts +++ b/types/stylelint/type-test.ts @@ -34,7 +34,6 @@ const options: Partial = { reportNeedlessDisables: true, ignorePath: ['foo'], customSyntax: 'postcss-scss', - syntax: 'scss', // Removed but still accepted in type definition config: { overrides: [ { From 3fa24f32b7c60146c7806cf292baf25eb6a7bfd0 Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Sun, 23 Oct 2022 11:38:01 +0300 Subject: [PATCH 3/7] remove syntax according tests --- lib/__tests__/standalone-syntax.test.js | 32 ------------------------- 1 file changed, 32 deletions(-) diff --git a/lib/__tests__/standalone-syntax.test.js b/lib/__tests__/standalone-syntax.test.js index c1bfe30b88..1c20bb8cc2 100644 --- a/lib/__tests__/standalone-syntax.test.js +++ b/lib/__tests__/standalone-syntax.test.js @@ -150,38 +150,6 @@ it('rejects on unknown custom syntax option', async () => { ); }); -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', - ); -}); - describe('customSyntax set in the config', () => { it('standalone with path to custom parser', async () => { const config = { From fc32ce620729771d30cf699dc9b1bda49dac9224 Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Sun, 23 Oct 2022 11:42:57 +0300 Subject: [PATCH 4/7] remove syntax option from cli --- lib/cli.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index d2d7cda8a8..62c97f454d 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -44,7 +44,6 @@ const EXIT_CODE_ERROR = 2; * @property {boolean} [reportDescriptionlessDisables] * @property {number} [maxWarnings] * @property {boolean} quiet - * @property {string} [syntax] * @property {string} [version] * @property {boolean} [allowEmptyInput] */ @@ -80,7 +79,6 @@ const EXIT_CODE_ERROR = 2; * @property {boolean} [reportDescriptionlessDisables] * @property {boolean} [disableDefaultIgnores] * @property {number} [maxWarnings] - * @property {string} [syntax] * @property {string[]} [ignorePattern] * @property {boolean} [allowEmptyInput] * @property {string} [files] @@ -329,10 +327,6 @@ const meowOptions = { stdinFilename: { type: 'string', }, - syntax: { - alias: 's', - type: 'string', - }, version: { alias: 'v', type: 'boolean', @@ -371,10 +365,6 @@ module.exports = async (argv) => { optionsBase.quiet = cli.flags.quiet; } - if (cli.flags.syntax) { - optionsBase.syntax = cli.flags.syntax; - } - if (cli.flags.customSyntax) { optionsBase.customSyntax = getModulePath(process.cwd(), cli.flags.customSyntax); } From 5b387910d2d4033675ba13a341f2b47d8eb95bdf Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Sun, 23 Oct 2022 11:44:28 +0300 Subject: [PATCH 5/7] remove cli syntax option test --- lib/__tests__/cli.test.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/__tests__/cli.test.js b/lib/__tests__/cli.test.js index f726813c54..d4ad8f5820 100644 --- a/lib/__tests__/cli.test.js +++ b/lib/__tests__/cli.test.js @@ -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); From 944de269178dcabd5f41663385ddbf5e10b59bbf Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Mon, 24 Oct 2022 10:06:40 +0300 Subject: [PATCH 6/7] remove syntax occurances from type defenition --- types/stylelint/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts index ae092934c0..1e5cf149cc 100644 --- a/types/stylelint/index.d.ts +++ b/types/stylelint/index.d.ts @@ -208,7 +208,6 @@ declare module 'stylelint' { codeFilename?: string; filePath?: string; codeProcessors?: CodeProcessor[]; - syntax?: string; customSyntax?: CustomSyntax; }; @@ -531,7 +530,7 @@ declare module 'stylelint' { export type DisableOptionsReport = DisableReportEntry[]; - export type PostcssPluginOptions = Omit | Config; + export type PostcssPluginOptions = Omit | Config; } const stylelint: stylelint.PublicApi; From 87c9bea4a5800ac305f4d468d69e0494a683bd1a Mon Sep 17 00:00:00 2001 From: fpetrakov Date: Mon, 24 Oct 2022 10:15:50 +0300 Subject: [PATCH 7/7] add changelog entry --- .changeset/nervous-insects-design.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nervous-insects-design.md diff --git a/.changeset/nervous-insects-design.md b/.changeset/nervous-insects-design.md new file mode 100644 index 0000000000..9b73afb4fc --- /dev/null +++ b/.changeset/nervous-insects-design.md @@ -0,0 +1,5 @@ +--- +"stylelint": major +--- + +Removed: `syntax` option