actool / eslint-plugin-actool Goto Github PK
View Code? Open in Web Editor NEW📓 Lint comments & code actuality
Home Page: https://www.npmjs.com/package/eslint-plugin-actool
License: MIT License
📓 Lint comments & code actuality
Home Page: https://www.npmjs.com/package/eslint-plugin-actool
License: MIT License
Т.к. сейчас слишком долго и это не кэшируется
// diff commits isn't in allowable boundaries
// diff commits is in allowable boundaries
Problem
Solution (optional)
Additional context (optional)
Common description of task
Look at rules
While:
relevant-comments-block
relevant-comments-line
relevant-comments-module
Add functions for validating two commits/date by available diff
function validateDiff(commit1: Commit, commit2: Commit, diff: number): boolean
function validateDiff(date1: Date, date2: Date, diff: number): boolean
Not need to parse commits manually - only need to impl two overloads of function
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 1) import React from "react";
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 2) import { Button } from "antd";
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 3) import { useAuth } from "../hooks";
a90ad368 (Ilya Azin 2020-11-21 23:38:33 +0300 4) import { routes } from "../consts";
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 5)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 6) const User = () => {
aad365d1 (Ilya Azin 2020-11-21 18:35:36 +0300 7) const { isAuth, logout, viewer } = useAuth();
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 8)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 9) /**
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 10) * FIXME: Использовать Link?
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 11) * (но для этого нужна будет обертка Auth.Router на уровне App)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 12) */
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 13) return (
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 14) <span className="auth-user">
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 15) {isAuth && (
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 16) <>
44054cbb (Ilya Azin 2020-11-12 12:47:18 +0300 17) {/* FIXME: use h3 instead */}
deb15768 (Ilya Azin 2020-11-21 23:21:15 +0300 18) <a className="m-4 text-white" href={`/${viewer?.username}`}>
deb15768 (Ilya Azin 2020-11-21 23:21:15 +0300 19) {viewer?.username}
16799632 (Ilya Azin 2020-11-02 10:28:39 +0300 20) </a>
a90ad368 (Ilya Azin 2020-11-21 23:38:33 +0300 21) <Button className="m-4" href={routes.logout} onClick={logout}>
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 22) Logout
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 23) </Button>
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 24) </>
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 25) )}
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 26) {!isAuth && (
a90ad368 (Ilya Azin 2020-11-21 23:38:33 +0300 27) <Button className="m-4" href={routes.login}>
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 28) Sign In
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 29) </Button>
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 30) )}
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 31) </span>
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 32) );
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 33) };
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 34)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 35) export default User;
Version
0.0.0.
Expected behavior
Plugin readme is adapted for npm
Actual behavior
Repro steps
{rule}.md
файле (пример)max-tags
(с доп.параметром scope: ["file", "project"])relevant-comments
(с доп. параметром scope: ["line", "block", "module"])no-commented-code
type Commit = {
hash: string;
date: string; (or Date - как удобнее)
name: string;
}
// Все это будет приходить извне
type Args = {
lines: [number, number];
filepath: string;
}
function getLastCommitOf({ lines, filepath }): Commit
getLastCommitOf({
lines: [1, 5],
filepath: "lib/rules/some-rule.js"
})
// { hash: "d32hea7f", name: "Ilya Azin", date: "2020-11-20T123" }
В утилитах уже есть метод getCommitByLine
, лучше воспользоваться им внутри реализации getLastCommitOf
Problem
Current impl is very hardcoded and not reliable
Solution
max-tags-file
rule implmax-tags-proj
scopeTo inspire for new features / rules or delete redundant
relevant-comments-block
relevant-comments-line
relevant-comments-module
no-commented-code
relevant-comments-block
relevant-comments-line
relevant-comments-module
no-commented-code
Parser (function):
getCommitByLine(filePath, 1)
// { author: "Ilya Azin", date: "2020-11-02 09:51:49+0300", commit: "b6988094" }
getCommitByLine(filePath, 24)
// { author: "Ilya Azin", date: "2020-11-02 10:05:41+0300", commit: "a0e08b6b" }
Should be parse by file, not by string
Aproximate !!!
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 1) import React from "react";
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 2) import { Button } from "antd";
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 3) import { useAuth } from "../hooks";
a90ad368 (Ilya Azin 2020-11-21 23:38:33 +0300 4) import { routes } from "../consts";
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 5)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 6) const User = () => {
aad365d1 (Ilya Azin 2020-11-21 18:35:36 +0300 7) const { isAuth, logout, viewer } = useAuth();
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 8)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 9) /**
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 10) * FIXME: Использовать Link?
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 11) * (но для этого нужна будет обертка Auth.Router на уровне App)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 12) */
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 13) return (
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 14) <span className="auth-user">
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 15) {isAuth && (
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 16) <>
44054cbb (Ilya Azin 2020-11-12 12:47:18 +0300 17) {/* FIXME: use h3 instead */}
deb15768 (Ilya Azin 2020-11-21 23:21:15 +0300 18) <a className="m-4 text-white" href={`/${viewer?.username}`}>
deb15768 (Ilya Azin 2020-11-21 23:21:15 +0300 19) {viewer?.username}
16799632 (Ilya Azin 2020-11-02 10:28:39 +0300 20) </a>
a90ad368 (Ilya Azin 2020-11-21 23:38:33 +0300 21) <Button className="m-4" href={routes.logout} onClick={logout}>
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 22) Logout
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 23) </Button>
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 24) </>
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 25) )}
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 26) {!isAuth && (
a90ad368 (Ilya Azin 2020-11-21 23:38:33 +0300 27) <Button className="m-4" href={routes.login}>
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 28) Sign In
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 29) </Button>
824d8e96 (Ilya Azin 2020-11-21 18:56:25 +0300 30) )}
a0e08b6b (Ilya Azin 2020-11-02 10:05:41 +0300 31) </span>
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 32) );
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 33) };
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 34)
b6988094 (Ilya Azin 2020-11-02 09:51:49 +0300 35) export default User;
Problem
It may be not clear for some users
Solution
Add motivation section in docs
Additional context
https://github.com/pbeshai/react-url-query#motivation
Problem
There is not enough functinoality of plugin
Solution
Add and specify base functionality of MVP version of plugin
Нужно разобраться как итерироваться по блокам кода а не по комментариям
Или же - нужно научиться находить по имеющимся комментарий относящийся к ним блок кода
Сейчас же пока это захардкожено (нужно находить не просто строчку, а весь интервал, для комментариев модульных - должно быть понимание, что сранивается весь файл)
Т.е. условно должна быть логика, которая на основании комментария дает нам строки соответствующего кода, который мы должны сравнить по коммитам
Add CI logic
For preventing TODOs/FIXMEs chaos
// TODO: 1
// FIXME: 2
...
// TODO: 8 (|| { USER_CONFIGURED by params })
// TODO: 1
// FIXME: 2
...
// TODO: 7 (|| { USER_CONFIGURED - 1 by params })
Нужна утилита, которая получает разницу между коммитами, скорее всего с вытягиванием истории
type Commit = {
author: string;
hash: string;
date: string;
};
// Данные приходят извне, нужно реализовать саму функцию
function getCommitsDiff(commit1: Commit, commit2: Commit): Commit[]
getCommitsDiff(c1, c2) // Commit [4] (т.е. между коммитами присутствует еще 4 промежуточных)
According to README point
Commits diff it greater of allowable
Commits diff it less or equal of allowable
Не работает кастомизация параметров даже для реализованных правил (см. max-tags)
max
для правила max-tags согласно доке
Т.е. чтобы можно было задать с помощью объекта макс. кол-во тегов на файл
null
vs { disabled: true }
)Т.е. должна делать примерно следующее:
type Commit = {
hash: string;
name: string;
date: string; // или Date - что удобнее будет
}
type Args = {
commits: Commit[];
// Как мне кажется, так удобнее будет обозначить рамки исходного кода который будет служить фильтром - но на свое усмотрение, может получше что найдется
lines: string[];
filepath: string;
}
// Все извне нам будет приходить, а вот реализовать надо будет саму функцию
function filterCommitsBySrc({ commits, lines, filepath }: Args}): Commit[]
filterCommitsBySrc({
commits: myCommits // Commit[]
lines: codeBlock.getLines() // string[]
filepath: "/lib/rules/some-rule.js" // string
})
// Commit[] (filtered by specified lines and filepath)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.