add stylePropObject
MODIFY
packages/@romejs/diagnostics/categories.ts
packages/@romejs/diagnostics/categories.ts
@@ -134,6 +134,7 @@ type LintDiagnosticCategory =
| 'lint/singleVarDeclarator'
| 'lint/sortImportExportSpecifiers'
| 'lint/sparseArray'
+ | 'lint/stylePropObject'
| 'lint/undeclaredVariables'
| 'lint/unsafeNegation'
| 'lint/unusedVariables';

MODIFY
packages/@romejs/diagnostics/descriptions.ts
packages/@romejs/diagnostics/descriptions.ts
@@ -286,6 +286,10 @@ export const descriptions = createMessages({
},
// @romejs/js-compiler
LINT: {
+ STYLE_PROP_OBJECT: {
+ category: 'lint/stylePropObject',
+ message: markup`<emphasis>style</emphasis> property value must be an object.`,
+ },
PENDING_FIXES: (
relativeFilename: string,
original: string,

MODIFY
packages/@romejs/js-compiler/lint/rules/index.ts
packages/@romejs/js-compiler/lint/rules/index.ts
@@ -49,6 +49,7 @@ import restrictedGlobals from './regular/restrictedGlobals';
import singleVarDeclarator from './regular/singleVarDeclarator';
import sortImportExportSpecifiers from './regular/sortImportExportSpecifiers';
import sparseArray from './regular/sparseArray';
+import stylePropObject from './react/stylePropObject';
import undeclaredVariables from './regular/undeclaredVariables';
import unsafeNegation from './regular/unsafeNegation';
import unusedVariables from './regular/unusedVariables';
@@ -97,6 +98,7 @@ export const lintTransforms = [
singleVarDeclarator,
sortImportExportSpecifiers,
sparseArray,
+ stylePropObject,
undeclaredVariables,
unsafeNegation,
unusedVariables,

ADD
packages/@romejs/js-compiler/lint/rules/react/stylePropObject.ts
+/**
+* Copyright (c) Facebook, Inc. and its affiliates.
+*
+* This source code is licensed under the MIT license found in the
+* LICENSE file in the root directory of this source tree.
+*/
+
+import {Path} from '@romejs/js-compiler';
+import {AnyNode} from '@romejs/js-ast';
+import {descriptions} from '@romejs/diagnostics';
+
+export default {
+ name: 'stylePropObject',
+ enter(path: Path): AnyNode {
+ const {node} = path;
+
+ if (
+ node.type === 'JSXAttribute' &&
+ node.name.name === 'style' &&
+ node.value !== undefined &&
+ ((node.value.type === 'JSXExpressionContainer' &&
+ node.value.expression.type !== 'ObjectExpression') ||
+ node.value.type !== 'JSXExpressionContainer')
+ ) {
+ path.context.addNodeDiagnostic(node, descriptions.LINT.STYLE_PROP_OBJECT);
+ }
+
+ return node;
+ },
+};

add stylePropObject