Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-reanimated

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-reanimated - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

8

dist/src/index.js

@@ -1,8 +0,10 @@

import { jsFunctionInWorklet } from "./rules";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const rules_1 = require("./rules");
const rules = {
rules: {
"js-function-in-worklet": jsFunctionInWorklet,
"js-function-in-worklet": rules_1.jsFunctionInWorklet,
},
};
export default rules;
exports.default = rules;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,9 @@

export { default as jsFunctionInWorklet } from "./js-function-in-worklet";
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsFunctionInWorklet = void 0;
var js_function_in_worklet_1 = require("./js-function-in-worklet");
Object.defineProperty(exports, "jsFunctionInWorklet", { enumerable: true, get: function () { return __importDefault(js_function_in_worklet_1).default; } });
//# sourceMappingURL=index.js.map

@@ -1,4 +0,6 @@

import { ESLintUtils } from "@typescript-eslint/experimental-utils";
import { isFunctionDeclaration, isBlock, isExpressionStatement, isFunctionTypeNode, getJSDocTags, isArrowFunction, isMethodSignature, isModuleBlock, isInterfaceDeclaration, } from "typescript";
const createRule = ESLintUtils.RuleCreator((name) => `https://github.com/wcandillon/eslint-plugin-reanimated/blob/master/rules/${name}.md`);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const experimental_utils_1 = require("@typescript-eslint/experimental-utils");
const typescript_1 = require("typescript");
const createRule = experimental_utils_1.ESLintUtils.RuleCreator((name) => `https://github.com/wcandillon/eslint-plugin-reanimated/blob/master/rules/${name}.md`);
const functionHooks = new Map([

@@ -36,3 +38,3 @@ ["useAnimatedStyle", [0]],

const JSFunctionInWorkletMessage = "{{name}} is not a worklet. Use runOnJS instead.";
export default createRule({
exports.default = createRule({
name: "js-function-in-worklet",

@@ -55,3 +57,3 @@ meta: {

// const sourceCode = context.getSourceCode();
const parserServices = ESLintUtils.getParserServices(context);
const parserServices = experimental_utils_1.ESLintUtils.getParserServices(context);
const checker = parserServices.program.getTypeChecker();

@@ -63,17 +65,17 @@ // const compilerOptions = parserServices.program.getCompilerOptions();

const decl = signature === null || signature === void 0 ? void 0 : signature.declaration;
if (decl !== undefined && isFunctionTypeNode(decl)) {
if (decl !== undefined && typescript_1.isFunctionTypeNode(decl)) {
//const r = checker.getResolvedSignature(tsNode.parent.ki);
const { parent } = decl;
if (isFunctionDeclaration(parent) &&
if (typescript_1.isFunctionDeclaration(parent) &&
((_a = parent.name) === null || _a === void 0 ? void 0 : _a.getText()) === "createWorklet") {
return true;
}
const tags = getJSDocTags(decl);
const tags = typescript_1.getJSDocTags(decl);
return (tags.filter((tag) => tag.tagName.getText() === "worklet").length > 0);
}
else if (decl !== undefined &&
(isFunctionDeclaration(decl) || isArrowFunction(decl))) {
if (decl.body && isBlock(decl.body)) {
(typescript_1.isFunctionDeclaration(decl) || typescript_1.isArrowFunction(decl))) {
if (decl.body && typescript_1.isBlock(decl.body)) {
const [statement] = decl.body.statements;
if (statement && isExpressionStatement(statement)) {
if (statement && typescript_1.isExpressionStatement(statement)) {
const esNode = parserServices.tsNodeToESTreeNodeMap.get(statement);

@@ -128,4 +130,4 @@ return esNode.directive === "worklet";

if (declaration &&
isMethodSignature(declaration) &&
isInterfaceDeclaration(declaration.parent) &&
typescript_1.isMethodSignature(declaration) &&
typescript_1.isInterfaceDeclaration(declaration.parent) &&
builtInFunctions.indexOf(declaration.parent.name.getText()) !== -1) {

@@ -135,4 +137,4 @@ return;

else if (declaration &&
isFunctionDeclaration(declaration) &&
isModuleBlock(declaration.parent) &&
typescript_1.isFunctionDeclaration(declaration) &&
typescript_1.isModuleBlock(declaration.parent) &&
declaration.parent.parent.name.getText() === "Animated") {

@@ -139,0 +141,0 @@ return;

@@ -1,2 +0,7 @@

import eslintPlugin from "../src";
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const src_1 = __importDefault(require("../src"));
function camelToUnderscore(key) {

@@ -8,3 +13,3 @@ const result = key.replace(/([A-Z])/g, " $1");

const ruleKeys = Object.keys({ jsFunctionInWorklet: true }).map((rule) => camelToUnderscore(rule));
const eslintPluginRuleKeys = Object.keys(eslintPlugin.rules);
const eslintPluginRuleKeys = Object.keys(src_1.default.rules);
it("exports all available rules", () => {

@@ -11,0 +16,0 @@ expect(ruleKeys).toEqual(expect.arrayContaining(eslintPluginRuleKeys));

@@ -1,6 +0,11 @@

import path from "path";
import fs from "fs";
import { ESLintUtils } from "@typescript-eslint/experimental-utils";
import rule from "../src/rules/js-function-in-worklet";
const ruleTester = new ESLintUtils.RuleTester({
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
const experimental_utils_1 = require("@typescript-eslint/experimental-utils");
const js_function_in_worklet_1 = __importDefault(require("../src/rules/js-function-in-worklet"));
const ruleTester = new experimental_utils_1.ESLintUtils.RuleTester({
parser: "@typescript-eslint/parser",

@@ -10,11 +15,11 @@ parserOptions: {

project: "./tsconfig.eslint.json",
tsconfigRootDir: path.join(__dirname, "fixtures"),
tsconfigRootDir: path_1.default.join(__dirname, "fixtures"),
sourceType: "module",
},
});
const code = (name) => fs.readFileSync(path.join(__dirname, name), "utf8");
const code = (name) => fs_1.default.readFileSync(path_1.default.join(__dirname, name), "utf8");
const VALID = "fixtures/valid";
const files = fs.readdirSync(path.join(__dirname, VALID));
const valid = files.map((file) => ({ code: code(path.join(VALID, file)) }));
ruleTester.run("js-function-in-worklet", rule, {
const files = fs_1.default.readdirSync(path_1.default.join(__dirname, VALID));
const valid = files.map((file) => ({ code: code(path_1.default.join(VALID, file)) }));
ruleTester.run("js-function-in-worklet", js_function_in_worklet_1.default, {
valid,

@@ -21,0 +26,0 @@ invalid: [

{
"name": "eslint-plugin-reanimated",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/src/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -7,3 +7,3 @@ {

"target": "es2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
//"module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"lib": ["es2017"], /* Specify library files to be included in the compilation. */

@@ -10,0 +10,0 @@ // "allowJs": true, /* Allow javascript files to be compiled. */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc