Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TatsuyaYamamoto/ff128ca667348ead4295e548ffe586cb to your computer and use it in GitHub Desktop.
Save TatsuyaYamamoto/ff128ca667348ead4295e548ffe586cb to your computer and use it in GitHub Desktop.
import { markdownTable } from "npm:markdown-table";
import v6 from "npm:@typescript-eslint/eslint-plugin@6.0.0";
import v5 from "npm:@typescript-eslint/eslint-plugin@5.62.0";
const v5Rules_recommended = Object.keys(v5.configs["recommended"].rules);
const v5Rules_recommendedRequiringTypeChecking = Object.keys(
v5.configs["recommended-requiring-type-checking"].rules
);
const v5Rules_strict = Object.keys(v5.configs["strict"].rules);
const v6Rules_recommended = Object.keys(v6.configs["recommended"].rules);
const v6Rules_recommendedTypeChecked = Object.keys(
v6.configs["recommended-type-checked"].rules
);
const v6Rules_strict = Object.keys(v6.configs["strict"].rules);
const v6Rules_strictTypeChecked = Object.keys(
v6.configs["strict-type-checked"].rules
);
const v6Rules_stylistic = Object.keys(v6.configs["stylistic"].rules);
const v6Rules_stylisticTypeChecked = Object.keys(
v6.configs["stylistic-type-checked"].rules
);
/* v5 */
// const rows = v5Rules_recommended.map((rule) => {
// return [
// `\`${rule}\``,
// v6Rules_recommended.includes(rule) ? "◯" : "-",
// v6Rules_recommendedTypeChecked.includes(rule) ? "◯" : "-",
// v6Rules_strict.includes(rule) ? "◯" : "-",
// v6Rules_strictTypeChecked.includes(rule) ? "◯" : "-",
// v6Rules_stylistic.includes(rule) ? "◯" : "-",
// v6Rules_stylisticTypeChecked.includes(rule) ? "◯" : "-",
// ];
// });
//
// console.log(
// markdownTable([
// ["v5 rule", "✅", "✅💭", "🔒", "🔒💭", "🎨", "🎨💭"],
// ...rows,
// ])
// );
/* v6 */
// const rows = v6Rules_strictTypeChecked
// .filter((rule) => {
// return !v6Rules_recommendedTypeChecked.includes(rule);
// })
// .map((rule) => {
// return [
// `\`${rule}\``,
// !v6Rules_strict.includes(rule) ? "💭" : "",
// v5Rules_recommended.includes(rule) ? "◯" : "-",
// v5Rules_recommendedRequiringTypeChecking.includes(rule) ? "◯" : "-",
// v5Rules_strict.includes(rule) ? "◯" : "-",
// ];
// });
// console.log(
// markdownTable([["v6 rule", "type-checked only", "✅", "✅💭", "🔒"], ...rows])
// );
/* v5-v6 recommended */
const v5RecommendedRules = [
...v5Rules_recommended,
...v5Rules_recommendedRequiringTypeChecking,
];
const v6RecommendedRules = [
...v6Rules_recommendedTypeChecked,
...v6Rules_stylisticTypeChecked,
];
const rows = [...v5RecommendedRules, ...v6RecommendedRules]
.map((rule) => {
return [
`\`${rule}\``,
v5RecommendedRules.includes(rule) ? "◯" : "-",
v6RecommendedRules.includes(rule) ? "◯" : "-",
];
})
.filter((row) => {
return row[1] !== "◯" || row[2] !== "◯";
});
console.log(markdownTable([["rule", "v5", "v6"], ...rows]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment