1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 04:52:26 -05:00

chore: add more lint rules

This commit is contained in:
Marvin Hagemeister 2024-12-03 13:45:44 +01:00
parent f3745f95f4
commit 46766438f8
4 changed files with 80 additions and 0 deletions

23
fo.json Normal file
View file

@ -0,0 +1,23 @@
{
"lint": {
"plugins2": ["npm:foo"],
"rules": {
"exclude": [
"ban-ts-comment",
"prefix/whatever"
]
},
"plugins": {
"foo/bar": {
"url": "./foo.js",
"rules": {
"exclude": {}
}
},
"specifier": "npm:foo/url",
"rules": {
"exclude": ""
}
}
}
}

3
foo.js
View file

@ -9,3 +9,6 @@ Vue.component("todo-item", {
Vue.component("Todo", {
// ...
});
describe("foo", () => {});
describe("foo", () => {});

9
foo.tsx Normal file
View file

@ -0,0 +1,9 @@
const a = <div style={{}} />;
const b = <div style="foo" />;
const c: Foo<number> = {
node: 2,
};
interface Foo<T> {
node: T;
}

View file

@ -65,6 +65,51 @@ export default {
name: PLUGIN_NAME,
rules: {
[RULE1_NAME]: rule,
"jsx-style-string": {
create(context) {
return {
VariableDeclaration(node) {
console.log("INTERFAcE", { ...node, parent: null });
},
JSXAttribute(node) {
if (
node.name.type === "Identifier" && node.name.value === "style" &&
node.value.type !== "StringLiteral"
) {
context.report({
node: node.value,
message: "Use a string literal for 'style'",
});
}
},
};
},
},
"jest/no-identical-title": {
create(context) {
console.log(context.source());
const seen = new Set();
return {
CallExpression(node) {
if (
node.callee.type === "Identifier" &&
node.callee.value === "describe" && node.arguments.length > 0 &&
node.arguments[0].expression.type === "StringLiteral"
) {
const name = node.arguments[0].expression.value;
if (seen.has(name)) {
context.report({
node,
message: `Duplicate describe title found`,
});
}
seen.add(name);
}
},
};
},
},
"vue/multi-word-component-names": {
create(context) {
return {