diff --git a/.changeset/lovely-swans-leave.md b/.changeset/lovely-swans-leave.md new file mode 100644 index 00000000..80631586 --- /dev/null +++ b/.changeset/lovely-swans-leave.md @@ -0,0 +1,5 @@ +--- +'@css-modules-kit/eslint-plugin': patch +--- + +fix: fix eslint crashing due to `composes` property diff --git a/.changeset/spotty-knives-report.md b/.changeset/spotty-knives-report.md new file mode 100644 index 00000000..03cce68a --- /dev/null +++ b/.changeset/spotty-knives-report.md @@ -0,0 +1,5 @@ +--- +'@css-modules-kit/stylelint-plugin': patch +--- + +refactor: refactor the syntax definition of `composes` property in stylelint-plugin diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts index 92749ba1..e9b13c32 100644 --- a/packages/eslint-plugin/src/index.ts +++ b/packages/eslint-plugin/src/index.ts @@ -36,17 +36,15 @@ const plugin = { }, }, properties: { - composes: { - // Example: - // - `composes: a;` - // - `composes: a from './test.module.css';` - // - `composes: a, b from './test.module.css';` - // - `composes: a b from './test.module.css';` - // - `composes: global(a) from './test.module.css';` - // - // ref: https://github.com/css-modules/postcss-modules-extract-imports/blob/16f9c570e517cf3558b88cf96dcadf794230965a/src/index.js - syntax: '[ [ | global() ] ,? ]+ [ from ]?', - }, + // Example: + // - `composes: a;` + // - `composes: a from './test.module.css';` + // - `composes: a, b from './test.module.css';` + // - `composes: a b from './test.module.css';` + // - `composes: global(a) from './test.module.css';` + // + // ref: https://github.com/css-modules/postcss-modules-extract-imports/blob/16f9c570e517cf3558b88cf96dcadf794230965a/src/index.js + composes: '[ [ | global() ] ]# [ from ]?', }, }, }, diff --git a/packages/stylelint-plugin/src/recommended.ts b/packages/stylelint-plugin/src/recommended.ts index 058f49ac..35d8f5fe 100644 --- a/packages/stylelint-plugin/src/recommended.ts +++ b/packages/stylelint-plugin/src/recommended.ts @@ -32,7 +32,7 @@ const recommendedConfig: Config = { // - `composes: global(a) from './test.module.css';` // // ref: https://github.com/css-modules/postcss-modules-extract-imports/blob/16f9c570e517cf3558b88cf96dcadf794230965a/src/index.js - composes: '[ [ | global() ] ,? ]+ [ from ]?', + composes: '[ [ | global() ] ]# [ from ]?', }, }, },