mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-30 01:17:07 +02:00
Tidy up ESLint usage (#836)
* Use Airbnb ESLint * Turn off rules * Add back * add website to eslint precommit * Add back * remove useless escape
This commit is contained in:
parent
936725c94d
commit
128dbfca0a
12 changed files with 467 additions and 12704 deletions
|
@ -4,39 +4,37 @@
|
|||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const escape = require('escape-string-regexp');
|
||||
|
||||
function blogRouting(baseUrl) {
|
||||
return new RegExp(`^${escape(baseUrl)}blog\/.*html$`);
|
||||
return new RegExp(`^${baseUrl}blog/.*html$`);
|
||||
}
|
||||
|
||||
function docsRouting(baseUrl) {
|
||||
return new RegExp(`^${escape(baseUrl)}docs\/.*html$`);
|
||||
return new RegExp(`^${baseUrl}docs/.*html$`);
|
||||
}
|
||||
|
||||
function dotRouting() {
|
||||
return /(?!.*html$)^\/.*\.[^\n\/]+$/;
|
||||
return /(?!.*html$)^\/.*\.[^\n/]+$/;
|
||||
}
|
||||
|
||||
function feedRouting(baseUrl) {
|
||||
return new RegExp(`^${escape(baseUrl)}blog\/(feed\.xml|atom\.xml)$`);
|
||||
return new RegExp(`^${baseUrl}blog/(feed.xml|atom.xml)$`);
|
||||
}
|
||||
|
||||
function noExtRouting() {
|
||||
return /\/[^\.]*\/?$/;
|
||||
return /\/[^.]*\/?$/;
|
||||
}
|
||||
|
||||
function pageRouting(baseUrl) {
|
||||
const gr = regex => regex.toString().replace(/(^\/|\/$)/gm, '');
|
||||
return new RegExp(
|
||||
`(?!${gr(docsRouting(baseUrl))}|${gr(blogRouting(baseUrl))})^${escape(
|
||||
baseUrl
|
||||
)}.*\.html$`
|
||||
`(?!${gr(docsRouting(baseUrl))}|${gr(
|
||||
blogRouting(baseUrl)
|
||||
)})^${baseUrl}.*.html$`
|
||||
);
|
||||
}
|
||||
|
||||
function sitemapRouting(baseUrl) {
|
||||
return new RegExp(`^${escape(baseUrl)}sitemap.xml$`);
|
||||
return new RegExp(`^${baseUrl}sitemap.xml$`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue