ESLint plugin for Vicinage.
npm install --save-dev @vicinage/eslint-pluginOnce you've installed the npm package you can enable the plugin and rules by opening your ESLint configuration file and adding the plugin and rules.
import { defineConfig } from 'eslint/config'
import vicinage from '@vicinage/eslint-plugin'
export default defineConfig([
{
files: ['**/*.{jsx,tsx}'],
extends: [
vicinage.configs.recommended,
//
],
},
])Requires styles that are statically analyzable. This rule will detect invalid styles and provides basic type checking for style values.
This rule helps to sort the style property keys according to property priorities.
This ESLint rule enforces the use of individual longhand CSS properties in place
of multi-value shorthands when using apply for reasons of consistency
and performance. The rule provides an autofix to replace the shorthand with the
equivalent longhand properties.
Using multi-value shorthands that cannot be safely split into equivalent longhands:
margin: '8px 16px'padding: '8px 16px 8px 16px'
Fix: Replace with equivalent longhands. Note: this is autofixable.
Why: font is a shorthand that overrides multiple font settings at once.
Fix: Replace with individual font properties. Note: this is autofixable.
fontSizefontFamilyfontStylefontWeight
Fix: Replace with individual sub-properties. Note: this is autofixable.
borderWidthborderStyleborderColor
This rule has a few custom config options that can be set.
{
allowImportant: false, // Whether `!important` is allowed
preferInline: false, // Whether the expansion uses logical direction properties over physical
}This rule disallows using className or style props or class attribute on elements that spread
apply() to avoid conflicts and unexpected behavior.
function Component() {
return (
<>
<div {...apply({ color: 'green' })} className="extra" />
<div {...apply({ color: 'green' })} style={{ color: 'red' }} />
</>
)
}