@compiled/eslint-plugin
Advanced tools
Comparing version 0.13.4 to 0.13.5
import type { Comment, ImportDeclaration } from 'estree'; | ||
/** | ||
* Return the "@ jsx jsx" JSX pragma (i.e. a comment that has special | ||
* meaning to the TypeScript compiler), if it exists AND if jsx is | ||
* imported from "@compiled/react". | ||
* Return the JSX pragma, which looks like this: | ||
* | ||
* /** @ jsx jsx * / | ||
* | ||
* ... if it exists AND if jsx is imported from "@compiled/react". | ||
* | ||
* The JSX pragma is a special comment at the _beginning_ of the file | ||
* used to find the jsx namespace in TypeScript. It is also used by Babel's | ||
* @babel/plugin-transform-react-jsx to override the function used | ||
* when converting JSX syntax to plain JS (React.createElement by default). | ||
*/ | ||
export declare const findJsxPragma: (comments: Comment[], compiledImports: ImportDeclaration[]) => Comment | undefined; | ||
export declare const findJsxImportSourcePragma: (comments: Comment[]) => Comment | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findJsxImportSourcePragma = exports.findJsxPragma = void 0; | ||
const utils_1 = require("@compiled/utils"); | ||
/** | ||
* Return the "@ jsx jsx" JSX pragma (i.e. a comment that has special | ||
* meaning to the TypeScript compiler), if it exists AND if jsx is | ||
* imported from "@compiled/react". | ||
* Return the JSX pragma, which looks like this: | ||
* | ||
* /** @ jsx jsx * / | ||
* | ||
* ... if it exists AND if jsx is imported from "@compiled/react". | ||
* | ||
* The JSX pragma is a special comment at the _beginning_ of the file | ||
* used to find the jsx namespace in TypeScript. It is also used by Babel's | ||
* @babel/plugin-transform-react-jsx to override the function used | ||
* when converting JSX syntax to plain JS (React.createElement by default). | ||
*/ | ||
@@ -16,3 +24,3 @@ const findJsxPragma = (comments, compiledImports) => { | ||
for (const comment of comments) { | ||
const match = /@jsx (\w+)/.exec(comment.value); | ||
const match = utils_1.JSX_ANNOTATION_REGEX.exec(comment.value); | ||
if (match) { | ||
@@ -19,0 +27,0 @@ jsxPragma = comment; |
{ | ||
"name": "@compiled/eslint-plugin", | ||
"version": "0.13.4", | ||
"version": "0.13.5", | ||
"description": "A familiar and performant compile time CSS-in-JS library for React.", | ||
@@ -23,3 +23,3 @@ "homepage": "https://compiledcssinjs.com/docs/pkg-eslint-plugin", | ||
"dependencies": { | ||
"@compiled/utils": "^0.9.1" | ||
"@compiled/utils": "^0.9.2" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
@@ -0,7 +1,15 @@ | ||
import { JSX_ANNOTATION_REGEX } from '@compiled/utils'; | ||
import type { Comment, ImportDeclaration } from 'estree'; | ||
/** | ||
* Return the "@ jsx jsx" JSX pragma (i.e. a comment that has special | ||
* meaning to the TypeScript compiler), if it exists AND if jsx is | ||
* imported from "@compiled/react". | ||
* Return the JSX pragma, which looks like this: | ||
* | ||
* /** @ jsx jsx * / | ||
* | ||
* ... if it exists AND if jsx is imported from "@compiled/react". | ||
* | ||
* The JSX pragma is a special comment at the _beginning_ of the file | ||
* used to find the jsx namespace in TypeScript. It is also used by Babel's | ||
* @babel/plugin-transform-react-jsx to override the function used | ||
* when converting JSX syntax to plain JS (React.createElement by default). | ||
*/ | ||
@@ -19,3 +27,3 @@ export const findJsxPragma = ( | ||
for (const comment of comments) { | ||
const match = /@jsx (\w+)/.exec(comment.value); | ||
const match = JSX_ANNOTATION_REGEX.exec(comment.value); | ||
if (match) { | ||
@@ -22,0 +30,0 @@ jsxPragma = comment; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
400193
9622
Updated@compiled/utils@^0.9.2