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

@kablamo/eslint-plugin

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kablamo/eslint-plugin - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

15

package.json
{
"name": "@kablamo/eslint-plugin",
"version": "1.0.1",
"version": "2.0.0",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/KablamoOSS/kerosene.git",
"directory": "packages/kerosene"
},
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/eslint-plugin",
"bugs": {

@@ -18,7 +14,12 @@ "url": "https://github.com/KablamoOSS/kerosene/issues"

"build": "exit 0",
"clean": "exit 0",
"test": "src/test.js"
},
"peerDependencies": {
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
"eslint": "^7.0.0"
},
"devDependencies": {
"@types/eslint": "^7.2.6",
"eslint": "^7.8.1"
}
}

@@ -21,9 +21,9 @@ # Kablamo eslint plugin

You can still suffix variables to the end of your test id for example `data-test-id={\`${testId.myId}-${uuid}\`}`.
You can still suffix variables to the end of your test id for example `data-testid={\`${testId.myId}-${uuid}\`}`.
### `test-id-consistent-naming`
This rule ensures common misspellings always get fixed to the kebab-case `data-test-id` by default.
This rule ensures common misspellings always get fixed to the kebab-case `data-testid` by default.
This can be configured to `data-testid`.
This can be configured to `data-test-id`.

@@ -35,3 +35,3 @@ ```js

rules: {
"test-id-consistent-naming": ["error", "data-testid"],
"@kablamo/test-id-consistent-naming": ["error", "data-test-id"],
},

@@ -38,0 +38,0 @@ };

@@ -9,6 +9,6 @@ module.exports.rules = {

rules: {
"@kablamo/test-id-prefix-match-path": 2,
"@kablamo/test-id-consistent-naming": [2, "data-test-id"],
"@kablamo/test-id-prefix-match-path": "error",
"@kablamo/test-id-consistent-naming": ["error", "data-testid"],
},
},
};

@@ -15,3 +15,3 @@ "use strict";

create(context) {
const pragma = context.options[0] || "data-test-id";
const pragma = context.options[0] || "data-testid";

@@ -18,0 +18,0 @@ const attributes = [

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

"use strict";
import { Rule } from "eslint";
import ruleTester from "../test/rule-tester";
import rule from "./test-id-consistent-naming";
import ruleTester from "../test/rule-tester";
const happyPath = "const element = () => <div data-test-id={testIds.button} />";
const happyPath = "const element = () => <div data-testid={testIds.button} />";
ruleTester.run("test-id-consistent-naming", rule, {
ruleTester.run("test-id-consistent-naming", rule as Rule.RuleModule, {
valid: [
{
code: "const element = () => <div data-test-id={testIds.button} />",
code: "const element = () => <div data-testid={testIds.button} />",
},

@@ -25,3 +25,3 @@ {

code: "const element = () => <div testId={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
errors: [{ message: "Test ID attribute should be named data-testid" }],
output: happyPath,

@@ -31,3 +31,3 @@ },

code: "const element = () => <div data-id-test={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
errors: [{ message: "Test ID attribute should be named data-testid" }],
output: happyPath,

@@ -37,3 +37,3 @@ },

code: "const element = () => <div data-testId={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
errors: [{ message: "Test ID attribute should be named data-testid" }],
output: happyPath,

@@ -43,3 +43,3 @@ },

code: "const element = () => <div data-testID={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
errors: [{ message: "Test ID attribute should be named data-testid" }],
output: happyPath,

@@ -49,3 +49,3 @@ },

code: "const element = () => <div dataTestId={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
errors: [{ message: "Test ID attribute should be named data-testid" }],
output: happyPath,

@@ -55,21 +55,15 @@ },

code: "const element = () => <div datatestid={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
errors: [{ message: "Test ID attribute should be named data-testid" }],
output: happyPath,
},
{
code: "const element = () => <div data-testid={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
code: "const element = () => <div data-test-id={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,
},
{
code: "const element = () => <div testId={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
output: happyPath,
},
{
code: "const element = () => <div data-id-test={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,

@@ -79,4 +73,4 @@ },

code: "const element = () => <div data-testId={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,

@@ -86,4 +80,4 @@ },

code: "const element = () => <div data-testID={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,

@@ -93,4 +87,4 @@ },

code: "const element = () => <div dataTestId={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,

@@ -100,10 +94,10 @@ },

code: "const element = () => <div datatestid={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,
},
{
code: "const element = () => <div data-testid={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-test-id" }],
options: ["data-test-id"],
code: "const element = () => <div data-test-id={testIds.button} />",
errors: [{ message: "Test ID attribute should be named data-testid" }],
options: ["data-testid"],
output: happyPath,

@@ -110,0 +104,0 @@ },

@@ -19,3 +19,3 @@ "use strict";

return {
CallExpression: function(node) {
CallExpression(node) {
if (node && node.callee && node.callee.name === "createTestIds") {

@@ -45,2 +45,3 @@ if (node.arguments.length < 0) {

}
return undefined;
},

@@ -47,0 +48,0 @@ };

// This test almost works
// eslint isn't being pulled in and configure correctly to run it yet
"use strict";
import { Rule } from "eslint";
import ruleTester from "../test/rule-tester";
import rule from "./test-id-prefix-match-path";
import ruleTester from "../test/rule-tester";

@@ -18,3 +17,3 @@ const testCode = (prefix: string) => `

ruleTester.run("test-id-prefix-match-path", rule, {
ruleTester.run("test-id-prefix-match-path", rule as Rule.RuleModule, {
valid: [

@@ -44,2 +43,3 @@ {

errors: [{ message: "Test ID prefix name is invalid" }],
output: testCode("components-atoms-button"),
},

@@ -50,2 +50,3 @@ {

errors: [{ message: "Test ID prefix name is invalid" }],
output: testCode("components-atoms-title"),
},

@@ -56,2 +57,3 @@ {

errors: [{ message: "Test ID prefix name is invalid" }],
output: testCode("components-atoms-input"),
},

@@ -62,4 +64,5 @@ {

errors: [{ message: "Test ID prefix name is invalid" }],
output: testCode("components-button"),
},
],
});
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