@dhzh/eslint-plugin-better-tailwindcss 0.0.0-stage → 4.9.0-patch
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +247 -2
- package/lib/api/defaults.d.ts +103 -0
- package/lib/api/defaults.d.ts.map +1 -0
- package/lib/api/defaults.js +34 -0
- package/lib/api/defaults.js.map +1 -0
- package/lib/api/types.d.ts +9 -0
- package/lib/api/types.d.ts.map +1 -0
- package/lib/api/types.js +5 -0
- package/lib/api/types.js.map +1 -0
- package/lib/async-utils/cache.d.ts +30 -0
- package/lib/async-utils/cache.d.ts.map +1 -0
- package/lib/async-utils/cache.js +116 -0
- package/lib/async-utils/cache.js.map +1 -0
- package/lib/async-utils/escape.d.ts +2 -0
- package/lib/async-utils/escape.d.ts.map +1 -0
- package/lib/async-utils/escape.js +5 -0
- package/lib/async-utils/escape.js.map +1 -0
- package/lib/async-utils/fs.d.ts +3 -0
- package/lib/async-utils/fs.d.ts.map +1 -0
- package/lib/async-utils/fs.js +28 -0
- package/lib/async-utils/fs.js.map +1 -0
- package/lib/async-utils/module.d.ts +3 -0
- package/lib/async-utils/module.d.ts.map +1 -0
- package/lib/async-utils/module.js +7 -0
- package/lib/async-utils/module.js.map +1 -0
- package/lib/async-utils/operations.d.ts +23 -0
- package/lib/async-utils/operations.d.ts.map +1 -0
- package/lib/async-utils/operations.js +2 -0
- package/lib/async-utils/operations.js.map +1 -0
- package/lib/async-utils/order.d.ts +4 -0
- package/lib/async-utils/order.d.ts.map +1 -0
- package/lib/async-utils/order.js +5 -0
- package/lib/async-utils/order.js.map +1 -0
- package/lib/async-utils/path.d.ts +2 -0
- package/lib/async-utils/path.d.ts.map +1 -0
- package/lib/async-utils/path.js +7 -0
- package/lib/async-utils/path.js.map +1 -0
- package/lib/async-utils/platform.d.ts +2 -0
- package/lib/async-utils/platform.d.ts.map +1 -0
- package/lib/async-utils/platform.js +4 -0
- package/lib/async-utils/platform.js.map +1 -0
- package/lib/async-utils/regex.d.ts +3 -0
- package/lib/async-utils/regex.d.ts.map +1 -0
- package/lib/async-utils/regex.js +32 -0
- package/lib/async-utils/regex.js.map +1 -0
- package/lib/async-utils/resolvers.d.ts +7 -0
- package/lib/async-utils/resolvers.d.ts.map +1 -0
- package/lib/async-utils/resolvers.js +64 -0
- package/lib/async-utils/resolvers.js.map +1 -0
- package/lib/async-utils/segment.d.ts +2 -0
- package/lib/async-utils/segment.d.ts.map +1 -0
- package/lib/async-utils/segment.js +82 -0
- package/lib/async-utils/segment.js.map +1 -0
- package/lib/async-utils/worker.d.ts +3 -0
- package/lib/async-utils/worker.d.ts.map +1 -0
- package/lib/async-utils/worker.js +17 -0
- package/lib/async-utils/worker.js.map +1 -0
- package/lib/configs/config.d.ts +3521 -0
- package/lib/configs/config.d.ts.map +1 -0
- package/lib/configs/config.js +98 -0
- package/lib/configs/config.js.map +1 -0
- package/lib/options/callees/cc.d.ts +30 -0
- package/lib/options/callees/cc.d.ts.map +1 -0
- package/lib/options/callees/cc.js +25 -0
- package/lib/options/callees/cc.js.map +1 -0
- package/lib/options/callees/clb.d.ts +35 -0
- package/lib/options/callees/clb.d.ts.map +1 -0
- package/lib/options/callees/clb.js +39 -0
- package/lib/options/callees/clb.js.map +1 -0
- package/lib/options/callees/clsx.d.ts +30 -0
- package/lib/options/callees/clsx.d.ts.map +1 -0
- package/lib/options/callees/clsx.js +25 -0
- package/lib/options/callees/clsx.js.map +1 -0
- package/lib/options/callees/cn.d.ts +30 -0
- package/lib/options/callees/cn.d.ts.map +1 -0
- package/lib/options/callees/cn.js +25 -0
- package/lib/options/callees/cn.js.map +1 -0
- package/lib/options/callees/cnb.d.ts +30 -0
- package/lib/options/callees/cnb.d.ts.map +1 -0
- package/lib/options/callees/cnb.js +25 -0
- package/lib/options/callees/cnb.js.map +1 -0
- package/lib/options/callees/ctl.d.ts +17 -0
- package/lib/options/callees/ctl.d.ts.map +1 -0
- package/lib/options/callees/ctl.js +15 -0
- package/lib/options/callees/ctl.js.map +1 -0
- package/lib/options/callees/cva.d.ts +40 -0
- package/lib/options/callees/cva.d.ts.map +1 -0
- package/lib/options/callees/cva.js +37 -0
- package/lib/options/callees/cva.js.map +1 -0
- package/lib/options/callees/cx.d.ts +30 -0
- package/lib/options/callees/cx.d.ts.map +1 -0
- package/lib/options/callees/cx.js +25 -0
- package/lib/options/callees/cx.js.map +1 -0
- package/lib/options/callees/dcnb.d.ts +30 -0
- package/lib/options/callees/dcnb.d.ts.map +1 -0
- package/lib/options/callees/dcnb.js +25 -0
- package/lib/options/callees/dcnb.js.map +1 -0
- package/lib/options/callees/objstr.d.ts +24 -0
- package/lib/options/callees/objstr.d.ts.map +1 -0
- package/lib/options/callees/objstr.js +24 -0
- package/lib/options/callees/objstr.js.map +1 -0
- package/lib/options/callees/tv.d.ts +64 -0
- package/lib/options/callees/tv.d.ts.map +1 -0
- package/lib/options/callees/tv.js +70 -0
- package/lib/options/callees/tv.js.map +1 -0
- package/lib/options/callees/twJoin.d.ts +17 -0
- package/lib/options/callees/twJoin.d.ts.map +1 -0
- package/lib/options/callees/twJoin.js +15 -0
- package/lib/options/callees/twJoin.js.map +1 -0
- package/lib/options/callees/twMerge.d.ts +17 -0
- package/lib/options/callees/twMerge.d.ts.map +1 -0
- package/lib/options/callees/twMerge.js +15 -0
- package/lib/options/callees/twMerge.js.map +1 -0
- package/lib/options/default-options.d.ts +114 -0
- package/lib/options/default-options.d.ts.map +1 -0
- package/lib/options/default-options.js +176 -0
- package/lib/options/default-options.js.map +1 -0
- package/lib/options/descriptions.d.ts +657 -0
- package/lib/options/descriptions.d.ts.map +1 -0
- package/lib/options/descriptions.js +22 -0
- package/lib/options/descriptions.js.map +1 -0
- package/lib/options/migrate.d.ts +16 -0
- package/lib/options/migrate.d.ts.map +1 -0
- package/lib/options/migrate.js +132 -0
- package/lib/options/migrate.js.map +1 -0
- package/lib/options/schemas/attributes.d.ts +100 -0
- package/lib/options/schemas/attributes.d.ts.map +1 -0
- package/lib/options/schemas/attributes.js +19 -0
- package/lib/options/schemas/attributes.js.map +1 -0
- package/lib/options/schemas/callees.d.ts +101 -0
- package/lib/options/schemas/callees.d.ts.map +1 -0
- package/lib/options/schemas/callees.js +19 -0
- package/lib/options/schemas/callees.js.map +1 -0
- package/lib/options/schemas/common.d.ts +30 -0
- package/lib/options/schemas/common.d.ts.map +1 -0
- package/lib/options/schemas/common.js +30 -0
- package/lib/options/schemas/common.js.map +1 -0
- package/lib/options/schemas/matchers.d.ts +13 -0
- package/lib/options/schemas/matchers.d.ts.map +1 -0
- package/lib/options/schemas/matchers.js +14 -0
- package/lib/options/schemas/matchers.js.map +1 -0
- package/lib/options/schemas/selectors.d.ts +1289 -0
- package/lib/options/schemas/selectors.d.ts.map +1 -0
- package/lib/options/schemas/selectors.js +100 -0
- package/lib/options/schemas/selectors.js.map +1 -0
- package/lib/options/schemas/tags.d.ts +101 -0
- package/lib/options/schemas/tags.d.ts.map +1 -0
- package/lib/options/schemas/tags.js +19 -0
- package/lib/options/schemas/tags.js.map +1 -0
- package/lib/options/schemas/variables.d.ts +100 -0
- package/lib/options/schemas/variables.d.ts.map +1 -0
- package/lib/options/schemas/variables.js +19 -0
- package/lib/options/schemas/variables.js.map +1 -0
- package/lib/options/tags/twc.d.ts +36 -0
- package/lib/options/tags/twc.d.ts.map +1 -0
- package/lib/options/tags/twc.js +26 -0
- package/lib/options/tags/twc.js.map +1 -0
- package/lib/options/tags/twx.d.ts +36 -0
- package/lib/options/tags/twx.d.ts.map +1 -0
- package/lib/options/tags/twx.js +26 -0
- package/lib/options/tags/twx.js.map +1 -0
- package/lib/parsers/angular.d.ts +11 -0
- package/lib/parsers/angular.d.ts.map +1 -0
- package/lib/parsers/angular.js +736 -0
- package/lib/parsers/angular.js.map +1 -0
- package/lib/parsers/css.d.ts +5 -0
- package/lib/parsers/css.d.ts.map +1 -0
- package/lib/parsers/css.js +100 -0
- package/lib/parsers/css.js.map +1 -0
- package/lib/parsers/es.d.ts +49 -0
- package/lib/parsers/es.d.ts.map +1 -0
- package/lib/parsers/es.js +924 -0
- package/lib/parsers/es.js.map +1 -0
- package/lib/parsers/html.d.ts +8 -0
- package/lib/parsers/html.d.ts.map +1 -0
- package/lib/parsers/html.js +51 -0
- package/lib/parsers/html.js.map +1 -0
- package/lib/parsers/jsx.d.ts +9 -0
- package/lib/parsers/jsx.d.ts.map +1 -0
- package/lib/parsers/jsx.js +118 -0
- package/lib/parsers/jsx.js.map +1 -0
- package/lib/parsers/svelte.d.ts +11 -0
- package/lib/parsers/svelte.d.ts.map +1 -0
- package/lib/parsers/svelte.js +204 -0
- package/lib/parsers/svelte.js.map +1 -0
- package/lib/parsers/vue.d.ts +9 -0
- package/lib/parsers/vue.d.ts.map +1 -0
- package/lib/parsers/vue.js +155 -0
- package/lib/parsers/vue.js.map +1 -0
- package/lib/rules/enforce-canonical-classes.d.ts +229 -0
- package/lib/rules/enforce-canonical-classes.d.ts.map +1 -0
- package/lib/rules/enforce-canonical-classes.js +84 -0
- package/lib/rules/enforce-canonical-classes.js.map +1 -0
- package/lib/rules/enforce-consistent-class-order.d.ts +229 -0
- package/lib/rules/enforce-consistent-class-order.d.ts.map +1 -0
- package/lib/rules/enforce-consistent-class-order.js +250 -0
- package/lib/rules/enforce-consistent-class-order.js.map +1 -0
- package/lib/rules/enforce-consistent-important-position.d.ts +225 -0
- package/lib/rules/enforce-consistent-important-position.d.ts.map +1 -0
- package/lib/rules/enforce-consistent-important-position.js +68 -0
- package/lib/rules/enforce-consistent-important-position.js.map +1 -0
- package/lib/rules/enforce-consistent-line-wrapping.d.ts +235 -0
- package/lib/rules/enforce-consistent-line-wrapping.d.ts.map +1 -0
- package/lib/rules/enforce-consistent-line-wrapping.js +537 -0
- package/lib/rules/enforce-consistent-line-wrapping.js.map +1 -0
- package/lib/rules/enforce-consistent-variable-syntax.d.ts +225 -0
- package/lib/rules/enforce-consistent-variable-syntax.d.ts.map +1 -0
- package/lib/rules/enforce-consistent-variable-syntax.js +164 -0
- package/lib/rules/enforce-consistent-variable-syntax.js.map +1 -0
- package/lib/rules/enforce-consistent-variant-order.d.ts +225 -0
- package/lib/rules/enforce-consistent-variant-order.d.ts.map +1 -0
- package/lib/rules/enforce-consistent-variant-order.js +77 -0
- package/lib/rules/enforce-consistent-variant-order.js.map +1 -0
- package/lib/rules/enforce-logical-properties.d.ts +227 -0
- package/lib/rules/enforce-logical-properties.d.ts.map +1 -0
- package/lib/rules/enforce-logical-properties.js +142 -0
- package/lib/rules/enforce-logical-properties.js.map +1 -0
- package/lib/rules/enforce-shorthand-classes.d.ts +229 -0
- package/lib/rules/enforce-shorthand-classes.d.ts.map +1 -0
- package/lib/rules/enforce-shorthand-classes.js +217 -0
- package/lib/rules/enforce-shorthand-classes.js.map +1 -0
- package/lib/rules/no-concatenated-classes.d.ts +225 -0
- package/lib/rules/no-concatenated-classes.d.ts.map +1 -0
- package/lib/rules/no-concatenated-classes.js +31 -0
- package/lib/rules/no-concatenated-classes.js.map +1 -0
- package/lib/rules/no-conflicting-classes.d.ts +225 -0
- package/lib/rules/no-conflicting-classes.d.ts.map +1 -0
- package/lib/rules/no-conflicting-classes.js +60 -0
- package/lib/rules/no-conflicting-classes.js.map +1 -0
- package/lib/rules/no-deprecated-classes.d.ts +227 -0
- package/lib/rules/no-deprecated-classes.d.ts.map +1 -0
- package/lib/rules/no-deprecated-classes.js +103 -0
- package/lib/rules/no-deprecated-classes.js.map +1 -0
- package/lib/rules/no-duplicate-classes.d.ts +225 -0
- package/lib/rules/no-duplicate-classes.d.ts.map +1 -0
- package/lib/rules/no-duplicate-classes.js +52 -0
- package/lib/rules/no-duplicate-classes.js.map +1 -0
- package/lib/rules/no-restricted-classes.d.ts +225 -0
- package/lib/rules/no-restricted-classes.d.ts.map +1 -0
- package/lib/rules/no-restricted-classes.js +57 -0
- package/lib/rules/no-restricted-classes.js.map +1 -0
- package/lib/rules/no-unknown-classes.d.ts +225 -0
- package/lib/rules/no-unknown-classes.d.ts.map +1 -0
- package/lib/rules/no-unknown-classes.js +82 -0
- package/lib/rules/no-unknown-classes.js.map +1 -0
- package/lib/rules/no-unnecessary-whitespace.d.ts +225 -0
- package/lib/rules/no-unnecessary-whitespace.d.ts.map +1 -0
- package/lib/rules/no-unnecessary-whitespace.js +141 -0
- package/lib/rules/no-unnecessary-whitespace.js.map +1 -0
- package/lib/tailwindcss/canonical-classes.async.v4.d.ts +3 -0
- package/lib/tailwindcss/canonical-classes.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/canonical-classes.async.v4.js +54 -0
- package/lib/tailwindcss/canonical-classes.async.v4.js.map +1 -0
- package/lib/tailwindcss/canonical-classes.d.ts +21 -0
- package/lib/tailwindcss/canonical-classes.d.ts.map +1 -0
- package/lib/tailwindcss/canonical-classes.js +16 -0
- package/lib/tailwindcss/canonical-classes.js.map +1 -0
- package/lib/tailwindcss/class-order.async.v3.d.ts +3 -0
- package/lib/tailwindcss/class-order.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/class-order.async.v3.js +4 -0
- package/lib/tailwindcss/class-order.async.v3.js.map +1 -0
- package/lib/tailwindcss/class-order.async.v4.d.ts +3 -0
- package/lib/tailwindcss/class-order.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/class-order.async.v4.js +4 -0
- package/lib/tailwindcss/class-order.async.v4.js.map +1 -0
- package/lib/tailwindcss/class-order.d.ts +11 -0
- package/lib/tailwindcss/class-order.d.ts.map +1 -0
- package/lib/tailwindcss/class-order.js +16 -0
- package/lib/tailwindcss/class-order.js.map +1 -0
- package/lib/tailwindcss/conflicting-classes.async.v4.d.ts +35 -0
- package/lib/tailwindcss/conflicting-classes.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/conflicting-classes.async.v4.js +82 -0
- package/lib/tailwindcss/conflicting-classes.async.v4.js.map +1 -0
- package/lib/tailwindcss/conflicting-classes.d.ts +19 -0
- package/lib/tailwindcss/conflicting-classes.d.ts.map +1 -0
- package/lib/tailwindcss/conflicting-classes.js +17 -0
- package/lib/tailwindcss/conflicting-classes.js.map +1 -0
- package/lib/tailwindcss/context.async.v3.d.ts +3 -0
- package/lib/tailwindcss/context.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/context.async.v3.js +13 -0
- package/lib/tailwindcss/context.async.v3.js.map +1 -0
- package/lib/tailwindcss/context.async.v4.d.ts +3 -0
- package/lib/tailwindcss/context.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/context.async.v4.js +82 -0
- package/lib/tailwindcss/context.async.v4.js.map +1 -0
- package/lib/tailwindcss/custom-component-classes.async.v3.d.ts +4 -0
- package/lib/tailwindcss/custom-component-classes.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/custom-component-classes.async.v3.js +4 -0
- package/lib/tailwindcss/custom-component-classes.async.v3.js.map +1 -0
- package/lib/tailwindcss/custom-component-classes.async.v4.d.ts +4 -0
- package/lib/tailwindcss/custom-component-classes.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/custom-component-classes.async.v4.js +101 -0
- package/lib/tailwindcss/custom-component-classes.async.v4.js.map +1 -0
- package/lib/tailwindcss/custom-component-classes.d.ts +11 -0
- package/lib/tailwindcss/custom-component-classes.d.ts.map +1 -0
- package/lib/tailwindcss/custom-component-classes.js +16 -0
- package/lib/tailwindcss/custom-component-classes.js.map +1 -0
- package/lib/tailwindcss/dissect-classes.async.v3.d.ts +4 -0
- package/lib/tailwindcss/dissect-classes.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/dissect-classes.async.v3.js +32 -0
- package/lib/tailwindcss/dissect-classes.async.v3.js.map +1 -0
- package/lib/tailwindcss/dissect-classes.async.v4.d.ts +3 -0
- package/lib/tailwindcss/dissect-classes.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/dissect-classes.async.v4.js +39 -0
- package/lib/tailwindcss/dissect-classes.async.v4.js.map +1 -0
- package/lib/tailwindcss/dissect-classes.d.ts +23 -0
- package/lib/tailwindcss/dissect-classes.d.ts.map +1 -0
- package/lib/tailwindcss/dissect-classes.js +16 -0
- package/lib/tailwindcss/dissect-classes.js.map +1 -0
- package/lib/tailwindcss/prefix.async.v3.d.ts +4 -0
- package/lib/tailwindcss/prefix.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/prefix.async.v3.js +7 -0
- package/lib/tailwindcss/prefix.async.v3.js.map +1 -0
- package/lib/tailwindcss/prefix.async.v4.d.ts +4 -0
- package/lib/tailwindcss/prefix.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/prefix.async.v4.js +7 -0
- package/lib/tailwindcss/prefix.async.v4.js.map +1 -0
- package/lib/tailwindcss/prefix.d.ts +13 -0
- package/lib/tailwindcss/prefix.d.ts.map +1 -0
- package/lib/tailwindcss/prefix.js +15 -0
- package/lib/tailwindcss/prefix.js.map +1 -0
- package/lib/tailwindcss/tailwind.async.worker.v3.d.ts +2 -0
- package/lib/tailwindcss/tailwind.async.worker.v3.d.ts.map +1 -0
- package/lib/tailwindcss/tailwind.async.worker.v3.js +57 -0
- package/lib/tailwindcss/tailwind.async.worker.v3.js.map +1 -0
- package/lib/tailwindcss/tailwind.async.worker.v4.d.ts +2 -0
- package/lib/tailwindcss/tailwind.async.worker.v4.d.ts.map +1 -0
- package/lib/tailwindcss/tailwind.async.worker.v4.js +56 -0
- package/lib/tailwindcss/tailwind.async.worker.v4.js.map +1 -0
- package/lib/tailwindcss/unknown-classes.async.v3.d.ts +4 -0
- package/lib/tailwindcss/unknown-classes.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/unknown-classes.async.v3.js +10 -0
- package/lib/tailwindcss/unknown-classes.async.v3.js.map +1 -0
- package/lib/tailwindcss/unknown-classes.async.v4.d.ts +3 -0
- package/lib/tailwindcss/unknown-classes.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/unknown-classes.async.v4.js +5 -0
- package/lib/tailwindcss/unknown-classes.async.v4.js.map +1 -0
- package/lib/tailwindcss/unknown-classes.d.ts +11 -0
- package/lib/tailwindcss/unknown-classes.d.ts.map +1 -0
- package/lib/tailwindcss/unknown-classes.js +21 -0
- package/lib/tailwindcss/unknown-classes.js.map +1 -0
- package/lib/tailwindcss/variant-order.async.v3.d.ts +3 -0
- package/lib/tailwindcss/variant-order.async.v3.d.ts.map +1 -0
- package/lib/tailwindcss/variant-order.async.v3.js +4 -0
- package/lib/tailwindcss/variant-order.async.v3.js.map +1 -0
- package/lib/tailwindcss/variant-order.async.v4.d.ts +3 -0
- package/lib/tailwindcss/variant-order.async.v4.d.ts.map +1 -0
- package/lib/tailwindcss/variant-order.async.v4.js +34 -0
- package/lib/tailwindcss/variant-order.async.v4.js.map +1 -0
- package/lib/tailwindcss/variant-order.d.ts +11 -0
- package/lib/tailwindcss/variant-order.d.ts.map +1 -0
- package/lib/tailwindcss/variant-order.js +16 -0
- package/lib/tailwindcss/variant-order.js.map +1 -0
- package/lib/types/ast.d.ts +79 -0
- package/lib/types/ast.d.ts.map +1 -0
- package/lib/types/ast.js +2 -0
- package/lib/types/ast.js.map +1 -0
- package/lib/types/async.d.ts +7 -0
- package/lib/types/async.d.ts.map +1 -0
- package/lib/types/async.js +2 -0
- package/lib/types/async.js.map +1 -0
- package/lib/types/estree.d.ts +7 -0
- package/lib/types/estree.d.ts.map +1 -0
- package/lib/types/estree.js +2 -0
- package/lib/types/estree.js.map +1 -0
- package/lib/types/rule.d.ts +163 -0
- package/lib/types/rule.d.ts.map +1 -0
- package/lib/types/rule.js +24 -0
- package/lib/types/rule.js.map +1 -0
- package/lib/utils/ast.d.ts +4 -0
- package/lib/utils/ast.d.ts.map +1 -0
- package/lib/utils/ast.js +9 -0
- package/lib/utils/ast.js.map +1 -0
- package/lib/utils/class.d.ts +12 -0
- package/lib/utils/class.d.ts.map +1 -0
- package/lib/utils/class.js +19 -0
- package/lib/utils/class.js.map +1 -0
- package/lib/utils/context.d.ts +20 -0
- package/lib/utils/context.d.ts.map +1 -0
- package/lib/utils/context.js +91 -0
- package/lib/utils/context.js.map +1 -0
- package/lib/utils/lint.d.ts +17 -0
- package/lib/utils/lint.d.ts.map +1 -0
- package/lib/utils/lint.js +40 -0
- package/lib/utils/lint.js.map +1 -0
- package/lib/utils/matchers.d.ts +24 -0
- package/lib/utils/matchers.d.ts.map +1 -0
- package/lib/utils/matchers.js +154 -0
- package/lib/utils/matchers.js.map +1 -0
- package/lib/utils/quotes.d.ts +3 -0
- package/lib/utils/quotes.d.ts.map +1 -0
- package/lib/utils/quotes.js +9 -0
- package/lib/utils/quotes.js.map +1 -0
- package/lib/utils/rule.d.ts +31 -0
- package/lib/utils/rule.d.ts.map +1 -0
- package/lib/utils/rule.js +349 -0
- package/lib/utils/rule.js.map +1 -0
- package/lib/utils/selectors.d.ts +3 -0
- package/lib/utils/selectors.d.ts.map +1 -0
- package/lib/utils/selectors.js +4 -0
- package/lib/utils/selectors.js.map +1 -0
- package/lib/utils/utils.d.ts +49 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +203 -0
- package/lib/utils/utils.js.map +1 -0
- package/lib/utils/valibot.d.ts +4 -0
- package/lib/utils/valibot.d.ts.map +1 -0
- package/lib/utils/valibot.js +12 -0
- package/lib/utils/valibot.js.map +1 -0
- package/lib/utils/version.d.ts +7 -0
- package/lib/utils/version.d.ts.map +1 -0
- package/lib/utils/version.js +6 -0
- package/lib/utils/version.js.map +1 -0
- package/lib/utils/visitedNodes.d.ts +4 -0
- package/lib/utils/visitedNodes.d.ts.map +1 -0
- package/lib/utils/visitedNodes.js +11 -0
- package/lib/utils/visitedNodes.js.map +1 -0
- package/lib/utils/warn.d.ts +2 -0
- package/lib/utils/warn.d.ts.map +1 -0
- package/lib/utils/warn.js +8 -0
- package/lib/utils/warn.js.map +1 -0
- package/package.json +163 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createGetDissectedClasses, getDissectedClasses } from "../tailwindcss/dissect-classes.js";
|
|
2
|
+
import { createGetVariantOrder, getVariantOrder } from "../tailwindcss/variant-order.js";
|
|
3
|
+
import { buildClass } from "../utils/class.js";
|
|
4
|
+
import { async } from "../utils/context.js";
|
|
5
|
+
import { lintClasses } from "../utils/lint.js";
|
|
6
|
+
import { VARIANT_ORDER_FLAGS } from "../async-utils/order.js";
|
|
7
|
+
import { createRule } from "../utils/rule.js";
|
|
8
|
+
import { splitClasses } from "../utils/utils.js";
|
|
9
|
+
export const enforceConsistentVariantOrder = createRule({
|
|
10
|
+
autofix: true,
|
|
11
|
+
category: "stylistic",
|
|
12
|
+
description: "Enforce a consistent variant order for Tailwind classes.",
|
|
13
|
+
docs: "https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-variant-order.md",
|
|
14
|
+
name: "enforce-consistent-variant-order",
|
|
15
|
+
recommended: false,
|
|
16
|
+
messages: {
|
|
17
|
+
order: "Incorrect variant order. '{{ className }}' should be '{{ fix }}'."
|
|
18
|
+
},
|
|
19
|
+
initialize: ctx => {
|
|
20
|
+
createGetDissectedClasses(ctx);
|
|
21
|
+
createGetVariantOrder(ctx);
|
|
22
|
+
},
|
|
23
|
+
lintLiterals: (ctx, literals) => {
|
|
24
|
+
if (ctx.version.major <= 3) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const asyncCtx = async(ctx);
|
|
28
|
+
for (const literal of literals) {
|
|
29
|
+
const classes = splitClasses(literal.content);
|
|
30
|
+
const { dissectedClasses, warnings: dissectedWarnings } = getDissectedClasses(asyncCtx, classes);
|
|
31
|
+
const { variantOrder, warnings } = getVariantOrder(asyncCtx, classes);
|
|
32
|
+
const allWarnings = [...dissectedWarnings, ...warnings];
|
|
33
|
+
lintClasses(ctx, literal, className => {
|
|
34
|
+
const dissectedClass = dissectedClasses[className];
|
|
35
|
+
if (!dissectedClass?.variants || dissectedClass.variants.length <= 1) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (dissectedClass.variants.some(variant => variantOrder[variant] === undefined)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const sortedVariants = dissectedClass.variants.toSorted((variantA, variantB) => {
|
|
42
|
+
return compareVariantOrder(variantOrder[variantA], variantOrder[variantB]);
|
|
43
|
+
});
|
|
44
|
+
if (dissectedClass.variants.every((value, index) => value === sortedVariants[index])) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const fix = buildClass(ctx, {
|
|
48
|
+
...dissectedClass,
|
|
49
|
+
variants: sortedVariants
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
data: {
|
|
53
|
+
className,
|
|
54
|
+
fix
|
|
55
|
+
},
|
|
56
|
+
fix,
|
|
57
|
+
id: "order",
|
|
58
|
+
warnings: allWarnings
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
function compareVariantOrder(orderA, orderB) {
|
|
65
|
+
if (orderA === orderB ||
|
|
66
|
+
orderA === undefined ||
|
|
67
|
+
orderB === undefined ||
|
|
68
|
+
orderA < VARIANT_ORDER_FLAGS.GLOBAL &&
|
|
69
|
+
orderB < VARIANT_ORDER_FLAGS.GLOBAL) {
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
if (orderB > orderA) {
|
|
73
|
+
return +1;
|
|
74
|
+
}
|
|
75
|
+
return -1;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=enforce-consistent-variant-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce-consistent-variant-order.js","sourceRoot":"","sources":["../../src/rules/enforce-consistent-variant-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO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MAAM,GAAG,mBAAmB,CAAC,MAAM,EACpC,CAAC;QACA,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAG,MAAM,GAAG,MAAM,EAAC,CAAC;QAClB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export declare const enforceLogicalProperties: {
|
|
2
|
+
category: "stylistic";
|
|
3
|
+
messages: {
|
|
4
|
+
readonly multiple: "Physical class detected. Replace \"{{ className }}\" with logical classes \"{{fix}}\".";
|
|
5
|
+
readonly single: "Physical class detected. Replace \"{{ className }}\" with logical class \"{{fix}}\".";
|
|
6
|
+
} | undefined;
|
|
7
|
+
name: "enforce-logical-properties";
|
|
8
|
+
readonly options: {
|
|
9
|
+
cwd?: string | undefined;
|
|
10
|
+
rootFontSize?: number | undefined;
|
|
11
|
+
detectComponentClasses: boolean;
|
|
12
|
+
tsconfig?: string | undefined;
|
|
13
|
+
tailwindConfig?: string | undefined;
|
|
14
|
+
messageStyle: "visual" | "compact" | "raw";
|
|
15
|
+
entryPoint?: string | undefined;
|
|
16
|
+
tags?: (string | [string, ({
|
|
17
|
+
match: import("../types/rule.js").MatcherType.String;
|
|
18
|
+
} | {
|
|
19
|
+
match: import("../types/rule.js").MatcherType.ObjectKey;
|
|
20
|
+
pathPattern?: string | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
match: import("../types/rule.js").MatcherType.ObjectValue;
|
|
23
|
+
pathPattern?: string | undefined;
|
|
24
|
+
})[]])[] | undefined;
|
|
25
|
+
variables?: (string | [string, ({
|
|
26
|
+
match: import("../types/rule.js").MatcherType.String;
|
|
27
|
+
} | {
|
|
28
|
+
match: import("../types/rule.js").MatcherType.ObjectKey;
|
|
29
|
+
pathPattern?: string | undefined;
|
|
30
|
+
} | {
|
|
31
|
+
match: import("../types/rule.js").MatcherType.ObjectValue;
|
|
32
|
+
pathPattern?: string | undefined;
|
|
33
|
+
})[]])[] | undefined;
|
|
34
|
+
attributes?: (string | [string, ({
|
|
35
|
+
match: import("../types/rule.js").MatcherType.String;
|
|
36
|
+
} | {
|
|
37
|
+
match: import("../types/rule.js").MatcherType.ObjectKey;
|
|
38
|
+
pathPattern?: string | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
match: import("../types/rule.js").MatcherType.ObjectValue;
|
|
41
|
+
pathPattern?: string | undefined;
|
|
42
|
+
})[]])[] | undefined;
|
|
43
|
+
callees?: (string | [string, ({
|
|
44
|
+
match: import("../types/rule.js").MatcherType.String;
|
|
45
|
+
} | {
|
|
46
|
+
match: import("../types/rule.js").MatcherType.ObjectKey;
|
|
47
|
+
pathPattern?: string | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
match: import("../types/rule.js").MatcherType.ObjectValue;
|
|
50
|
+
pathPattern?: string | undefined;
|
|
51
|
+
})[]])[] | undefined;
|
|
52
|
+
selectors: ({
|
|
53
|
+
callTarget?: number | "all" | "first" | "last" | undefined;
|
|
54
|
+
kind: import("../types/rule.js").SelectorKind.Callee;
|
|
55
|
+
match?: ({
|
|
56
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
57
|
+
} | {
|
|
58
|
+
path?: string | undefined;
|
|
59
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
60
|
+
} | {
|
|
61
|
+
path?: string | undefined;
|
|
62
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
63
|
+
} | {
|
|
64
|
+
match: ({
|
|
65
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
66
|
+
} | {
|
|
67
|
+
path?: string | undefined;
|
|
68
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
69
|
+
} | {
|
|
70
|
+
path?: string | undefined;
|
|
71
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
72
|
+
})[];
|
|
73
|
+
type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
|
|
74
|
+
})[] | undefined;
|
|
75
|
+
name: string;
|
|
76
|
+
path?: string | undefined;
|
|
77
|
+
targetArgument?: number | "all" | "first" | "last" | undefined;
|
|
78
|
+
targetCall?: number | "all" | "first" | "last" | undefined;
|
|
79
|
+
} | {
|
|
80
|
+
callTarget?: number | "all" | "first" | "last" | undefined;
|
|
81
|
+
kind: import("../types/rule.js").SelectorKind.Callee;
|
|
82
|
+
match?: ({
|
|
83
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
84
|
+
} | {
|
|
85
|
+
path?: string | undefined;
|
|
86
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
87
|
+
} | {
|
|
88
|
+
path?: string | undefined;
|
|
89
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
90
|
+
} | {
|
|
91
|
+
match: ({
|
|
92
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
93
|
+
} | {
|
|
94
|
+
path?: string | undefined;
|
|
95
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
96
|
+
} | {
|
|
97
|
+
path?: string | undefined;
|
|
98
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
99
|
+
})[];
|
|
100
|
+
type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
|
|
101
|
+
})[] | undefined;
|
|
102
|
+
name?: string | undefined;
|
|
103
|
+
path: string;
|
|
104
|
+
targetArgument?: number | "all" | "first" | "last" | undefined;
|
|
105
|
+
targetCall?: number | "all" | "first" | "last" | undefined;
|
|
106
|
+
} | {
|
|
107
|
+
kind: import("../types/rule.js").SelectorKind.Tag;
|
|
108
|
+
match?: ({
|
|
109
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
110
|
+
} | {
|
|
111
|
+
path?: string | undefined;
|
|
112
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
113
|
+
} | {
|
|
114
|
+
path?: string | undefined;
|
|
115
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
116
|
+
} | {
|
|
117
|
+
match: ({
|
|
118
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
119
|
+
} | {
|
|
120
|
+
path?: string | undefined;
|
|
121
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
122
|
+
} | {
|
|
123
|
+
path?: string | undefined;
|
|
124
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
125
|
+
})[];
|
|
126
|
+
type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
|
|
127
|
+
})[] | undefined;
|
|
128
|
+
name: string;
|
|
129
|
+
path?: string | undefined;
|
|
130
|
+
} | {
|
|
131
|
+
kind: import("../types/rule.js").SelectorKind.Tag;
|
|
132
|
+
match?: ({
|
|
133
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
134
|
+
} | {
|
|
135
|
+
path?: string | undefined;
|
|
136
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
137
|
+
} | {
|
|
138
|
+
path?: string | undefined;
|
|
139
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
140
|
+
} | {
|
|
141
|
+
match: ({
|
|
142
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
143
|
+
} | {
|
|
144
|
+
path?: string | undefined;
|
|
145
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
146
|
+
} | {
|
|
147
|
+
path?: string | undefined;
|
|
148
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
149
|
+
})[];
|
|
150
|
+
type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
|
|
151
|
+
})[] | undefined;
|
|
152
|
+
name?: string | undefined;
|
|
153
|
+
path: string;
|
|
154
|
+
} | {
|
|
155
|
+
kind: import("../types/rule.js").SelectorKind.Attribute;
|
|
156
|
+
match?: ({
|
|
157
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
158
|
+
} | {
|
|
159
|
+
path?: string | undefined;
|
|
160
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
161
|
+
} | {
|
|
162
|
+
path?: string | undefined;
|
|
163
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
164
|
+
} | {
|
|
165
|
+
match: ({
|
|
166
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
167
|
+
} | {
|
|
168
|
+
path?: string | undefined;
|
|
169
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
170
|
+
} | {
|
|
171
|
+
path?: string | undefined;
|
|
172
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
173
|
+
})[];
|
|
174
|
+
type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
|
|
175
|
+
})[] | undefined;
|
|
176
|
+
name: string;
|
|
177
|
+
} | {
|
|
178
|
+
kind: import("../types/rule.js").SelectorKind.Variable;
|
|
179
|
+
match?: ({
|
|
180
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
181
|
+
} | {
|
|
182
|
+
path?: string | undefined;
|
|
183
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
184
|
+
} | {
|
|
185
|
+
path?: string | undefined;
|
|
186
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
187
|
+
} | {
|
|
188
|
+
match: ({
|
|
189
|
+
type: import("../types/rule.js").MatcherType.String;
|
|
190
|
+
} | {
|
|
191
|
+
path?: string | undefined;
|
|
192
|
+
type: import("../types/rule.js").MatcherType.ObjectKey;
|
|
193
|
+
} | {
|
|
194
|
+
path?: string | undefined;
|
|
195
|
+
type: import("../types/rule.js").MatcherType.ObjectValue;
|
|
196
|
+
})[];
|
|
197
|
+
type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
|
|
198
|
+
})[] | undefined;
|
|
199
|
+
name: string;
|
|
200
|
+
})[];
|
|
201
|
+
} & {
|
|
202
|
+
ignore: string[];
|
|
203
|
+
};
|
|
204
|
+
recommended: false;
|
|
205
|
+
rule: {
|
|
206
|
+
create: (ctx: import("eslint").Rule.RuleContext) => import("eslint").Rule.RuleListener;
|
|
207
|
+
meta: {
|
|
208
|
+
messages?: {
|
|
209
|
+
readonly multiple: "Physical class detected. Replace \"{{ className }}\" with logical classes \"{{fix}}\".";
|
|
210
|
+
readonly single: "Physical class detected. Replace \"{{ className }}\" with logical class \"{{fix}}\".";
|
|
211
|
+
};
|
|
212
|
+
docs: {
|
|
213
|
+
description: string;
|
|
214
|
+
recommended: boolean;
|
|
215
|
+
url: string;
|
|
216
|
+
};
|
|
217
|
+
fixable: "code" | undefined;
|
|
218
|
+
schema: {
|
|
219
|
+
additionalProperties: false;
|
|
220
|
+
properties: Record<string, boolean | import("@valibot/to-json-schema").JsonSchema> | undefined;
|
|
221
|
+
type: "object";
|
|
222
|
+
}[];
|
|
223
|
+
type: "problem" | "layout";
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=enforce-logical-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce-logical-properties.d.ts","sourceRoot":"","sources":["../../src/rules/enforce-logical-properties.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BnC,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { array, description, optional, pipe, strictObject, string } from "valibot";
|
|
2
|
+
import { createGetDissectedClasses, getDissectedClasses } from "../tailwindcss/dissect-classes.js";
|
|
3
|
+
import { createGetUnknownClasses, getUnknownClasses } from "../tailwindcss/unknown-classes.js";
|
|
4
|
+
import { buildClass } from "../utils/class.js";
|
|
5
|
+
import { async } from "../utils/context.js";
|
|
6
|
+
import { lintClasses } from "../utils/lint.js";
|
|
7
|
+
import { getCachedRegex } from "../async-utils/regex.js";
|
|
8
|
+
import { createRule } from "../utils/rule.js";
|
|
9
|
+
import { replacePlaceholders, splitClasses } from "../utils/utils.js";
|
|
10
|
+
export const enforceLogicalProperties = createRule({
|
|
11
|
+
autofix: true,
|
|
12
|
+
category: "stylistic",
|
|
13
|
+
description: "Enforce logical property class names instead of physical directions.",
|
|
14
|
+
docs: "https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-logical-properties.md",
|
|
15
|
+
name: "enforce-logical-properties",
|
|
16
|
+
recommended: false,
|
|
17
|
+
schema: strictObject({
|
|
18
|
+
ignore: optional(pipe(array(string()), description("A list of regular expression patterns for classes that should be ignored by the rule.")), [])
|
|
19
|
+
}),
|
|
20
|
+
messages: {
|
|
21
|
+
multiple: "Physical class detected. Replace \"{{ className }}\" with logical classes \"{{fix}}\".",
|
|
22
|
+
single: "Physical class detected. Replace \"{{ className }}\" with logical class \"{{fix}}\"."
|
|
23
|
+
},
|
|
24
|
+
initialize: ctx => {
|
|
25
|
+
createGetDissectedClasses(ctx);
|
|
26
|
+
createGetUnknownClasses(ctx);
|
|
27
|
+
},
|
|
28
|
+
lintLiterals: (ctx, literals) => lintLiterals(ctx, literals)
|
|
29
|
+
});
|
|
30
|
+
const mappings = [
|
|
31
|
+
[/^pl-(.*)$/, "ps-$1"],
|
|
32
|
+
[/^pr-(.*)$/, "pe-$1"],
|
|
33
|
+
[/^pt-(.*)$/, "pbs-$1"],
|
|
34
|
+
[/^pb-(.*)$/, "pbe-$1"],
|
|
35
|
+
[/^ml-(.*)$/, "ms-$1"],
|
|
36
|
+
[/^mr-(.*)$/, "me-$1"],
|
|
37
|
+
[/^mt-(.*)$/, "mbs-$1"],
|
|
38
|
+
[/^mb-(.*)$/, "mbe-$1"],
|
|
39
|
+
[/^scroll-ml-(.*)$/, "scroll-ms-$1"],
|
|
40
|
+
[/^scroll-mr-(.*)$/, "scroll-me-$1"],
|
|
41
|
+
[/^scroll-pl-(.*)$/, "scroll-ps-$1"],
|
|
42
|
+
[/^scroll-pr-(.*)$/, "scroll-pe-$1"],
|
|
43
|
+
[/^scroll-mt-(.*)$/, "scroll-mbs-$1"],
|
|
44
|
+
[/^scroll-mb-(.*)$/, "scroll-mbe-$1"],
|
|
45
|
+
[/^scroll-pt-(.*)$/, "scroll-pbs-$1"],
|
|
46
|
+
[/^scroll-pb-(.*)$/, "scroll-pbe-$1"],
|
|
47
|
+
[/^left-(.*)$/, "inset-s-$1"],
|
|
48
|
+
[/^right-(.*)$/, "inset-e-$1"],
|
|
49
|
+
[/^top-(.*)$/, "inset-bs-$1"],
|
|
50
|
+
[/^bottom-(.*)$/, "inset-be-$1"],
|
|
51
|
+
[/^border-l$/, "border-s"],
|
|
52
|
+
[/^border-l-(.*)$/, "border-s-$1"],
|
|
53
|
+
[/^border-r$/, "border-e"],
|
|
54
|
+
[/^border-r-(.*)$/, "border-e-$1"],
|
|
55
|
+
[/^border-t$/, "border-bs"],
|
|
56
|
+
[/^border-t-(.*)$/, "border-bs-$1"],
|
|
57
|
+
[/^border-b$/, "border-be"],
|
|
58
|
+
[/^border-b-(.*)$/, "border-be-$1"],
|
|
59
|
+
[/^rounded-l$/, "rounded-s"],
|
|
60
|
+
[/^rounded-l-(.*)$/, "rounded-s-$1"],
|
|
61
|
+
[/^rounded-r$/, "rounded-e"],
|
|
62
|
+
[/^rounded-r-(.*)$/, "rounded-e-$1"],
|
|
63
|
+
[/^rounded-tl$/, "rounded-ss"],
|
|
64
|
+
[/^rounded-tl-(.*)$/, "rounded-ss-$1"],
|
|
65
|
+
[/^rounded-tr$/, "rounded-se"],
|
|
66
|
+
[/^rounded-tr-(.*)$/, "rounded-se-$1"],
|
|
67
|
+
[/^rounded-br$/, "rounded-ee"],
|
|
68
|
+
[/^rounded-br-(.*)$/, "rounded-ee-$1"],
|
|
69
|
+
[/^rounded-bl$/, "rounded-es"],
|
|
70
|
+
[/^rounded-bl-(.*)$/, "rounded-es-$1"],
|
|
71
|
+
[/^text-left$/, "text-start"],
|
|
72
|
+
[/^text-right$/, "text-end"],
|
|
73
|
+
[/^float-left$/, "float-start"],
|
|
74
|
+
[/^float-right$/, "float-end"],
|
|
75
|
+
[/^clear-left$/, "clear-start"],
|
|
76
|
+
[/^clear-right$/, "clear-end"],
|
|
77
|
+
[/^h-(.*)$/, "block-$1"],
|
|
78
|
+
[/^w-(.*)$/, "inline-$1"],
|
|
79
|
+
[/^min-h-(.*)$/, "min-block-$1"],
|
|
80
|
+
[/^min-w-(.*)$/, "min-inline-$1"],
|
|
81
|
+
[/^max-h-(.*)$/, "max-block-$1"],
|
|
82
|
+
[/^max-w-(.*)$/, "max-inline-$1"],
|
|
83
|
+
[/^size-(.*)$/, ["block-$1", "inline-$1"]]
|
|
84
|
+
];
|
|
85
|
+
function lintLiterals(ctx, literals) {
|
|
86
|
+
const { ignore } = ctx.options;
|
|
87
|
+
const ignoredClassRegexes = ignore.map(ignoredClass => getCachedRegex(ignoredClass));
|
|
88
|
+
const asyncCtx = async(ctx);
|
|
89
|
+
for (const literal of literals) {
|
|
90
|
+
const classes = splitClasses(literal.content);
|
|
91
|
+
const { dissectedClasses, warnings } = getDissectedClasses(asyncCtx, classes);
|
|
92
|
+
const possibleFixes = Object.values(dissectedClasses).flatMap(dissectedClass => {
|
|
93
|
+
const replacementBases = getReplacementBases(dissectedClass.base);
|
|
94
|
+
if (!replacementBases) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
return replacementBases.map(base => buildClass(ctx, { ...dissectedClass, base }));
|
|
98
|
+
});
|
|
99
|
+
const { unknownClasses } = getUnknownClasses(asyncCtx, possibleFixes);
|
|
100
|
+
lintClasses(ctx, literal, className => {
|
|
101
|
+
if (ignoredClassRegexes.some(ignoredClassRegex => ignoredClassRegex.test(className))) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const dissectedClass = dissectedClasses[className];
|
|
105
|
+
if (!dissectedClass) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const replacementBases = getReplacementBases(dissectedClass.base);
|
|
109
|
+
if (!replacementBases) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const fixClasses = replacementBases.map(base => buildClass(ctx, { ...dissectedClass, base }));
|
|
113
|
+
const hasUnknownFix = fixClasses.some(fixClass => unknownClasses.includes(fixClass));
|
|
114
|
+
if (hasUnknownFix) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const fix = fixClasses.join(" ");
|
|
118
|
+
const id = fixClasses.length > 1 ? "multiple" : "single";
|
|
119
|
+
return {
|
|
120
|
+
data: {
|
|
121
|
+
className,
|
|
122
|
+
fix
|
|
123
|
+
},
|
|
124
|
+
fix,
|
|
125
|
+
id,
|
|
126
|
+
warnings
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function getReplacementBases(base) {
|
|
132
|
+
for (const [pattern, replacement] of mappings) {
|
|
133
|
+
const match = base.match(pattern);
|
|
134
|
+
if (!match) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
return Array.isArray(replacement)
|
|
138
|
+
? replacement.map(part => replacePlaceholders(part, match))
|
|
139
|
+
: [replacePlaceholders(replacement, match)];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=enforce-logical-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enforce-logical-properties.js","sourceRoot":"","sources":["../../src/rules/enforce-logical-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAA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