-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #350 from laststance/ryota-murakami/create-website
Create website listing all lint rules
- Loading branch information
Showing
5 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>ESLint Config TS Prefixer Lint Rules</title> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>ESLint Config TS Prefixer Lint Rules</h1> | ||
</header> | ||
<section id="overview"> | ||
<h2>Overview</h2> | ||
<p>Welcome to the ESLint Config TS Prefixer website. Here, you can find a comprehensive list of lint rules derived from the original documentation, organized for your convenience.</p> | ||
</section> | ||
<nav> | ||
<h2>Lint Rule Categories</h2> | ||
<ul> | ||
<li><a href="#stylistic-rules">Stylistic Rules</a></li> | ||
<li><a href="#best-practices">Best Practices</a></li> | ||
<li><a href="#ecmascript-6">ECMAScript 6</a></li> | ||
<li><a href="#variables">Variables</a></li> | ||
<li><a href="#possible-errors">Possible Errors</a></li> | ||
</ul> | ||
</nav> | ||
<script src="scripts.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Function to dynamically load lint rule descriptions | ||
async function loadLintRules() { | ||
const eslintRulesUrl = 'https://github.com/eslint/eslint/tree/main/docs/src/rules'; | ||
const typescriptEslintRulesUrl = 'https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules'; | ||
|
||
try { | ||
const [eslintResponse, typescriptEslintResponse] = await Promise.all([ | ||
fetch(eslintRulesUrl), | ||
fetch(typescriptEslintRulesUrl) | ||
]); | ||
|
||
const eslintRules = await eslintResponse.json(); | ||
const typescriptEslintRules = await typescriptEslintResponse.json(); | ||
|
||
displayRules(eslintRules, 'ESLint Rules'); | ||
displayRules(typescriptEslintRules, 'TypeScript ESLint Rules'); | ||
} catch (error) { | ||
console.error('Failed to load lint rules:', error); | ||
} | ||
} | ||
|
||
// Function to display rules on the page | ||
function displayRules(rules, title) { | ||
const rulesContainer = document.createElement('div'); | ||
rulesContainer.className = 'rules-container'; | ||
|
||
const rulesTitle = document.createElement('h2'); | ||
rulesTitle.textContent = title; | ||
rulesContainer.appendChild(rulesTitle); | ||
|
||
const rulesList = document.createElement('ul'); | ||
rules.forEach(rule => { | ||
const ruleItem = document.createElement('li'); | ||
ruleItem.textContent = rule.name; | ||
rulesList.appendChild(ruleItem); | ||
}); | ||
rulesContainer.appendChild(rulesList); | ||
|
||
document.body.appendChild(rulesContainer); | ||
} | ||
|
||
// Search and filter functionality | ||
function setupSearchAndFilter() { | ||
const searchInput = document.getElementById('search'); | ||
searchInput.addEventListener('input', (event) => { | ||
const searchTerm = event.target.value.toLowerCase(); | ||
const ruleItems = document.querySelectorAll('.rules-container li'); | ||
ruleItems.forEach(item => { | ||
const isVisible = item.textContent.toLowerCase().includes(searchTerm); | ||
item.style.display = isVisible ? 'block' : 'none'; | ||
}); | ||
}); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
loadLintRules(); | ||
setupSearchAndFilter(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* Basic styles for layout, typography, and color scheme */ | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #f4f4f4; | ||
color: #333; | ||
} | ||
|
||
header { | ||
background-color: #007BFF; | ||
color: #fff; | ||
padding: 20px; | ||
text-align: center; | ||
} | ||
|
||
section#overview { | ||
padding: 20px; | ||
} | ||
|
||
nav { | ||
background-color: #333; | ||
color: #fff; | ||
padding: 20px; | ||
} | ||
|
||
nav ul { | ||
list-style: none; | ||
padding: 0; | ||
} | ||
|
||
nav ul li { | ||
margin-bottom: 10px; | ||
} | ||
|
||
nav ul li a { | ||
color: #fff; | ||
text-decoration: none; | ||
} | ||
|
||
/* Ensure responsiveness for mobile devices */ | ||
@media (max-width: 600px) { | ||
header, section, nav { | ||
padding: 10px; | ||
} | ||
} |