mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-25 23:17:06 +02:00
ESLintify Part 1 (#837)
* ESLint-ify * Allow empty try/catch * Escape regexp
This commit is contained in:
parent
128dbfca0a
commit
e8e3f42685
44 changed files with 466 additions and 555 deletions
|
@ -9,15 +9,16 @@
|
|||
|
||||
/* generate the i18n/en.json file */
|
||||
|
||||
const CWD = process.cwd();
|
||||
const fs = require('fs-extra');
|
||||
const mkdirp = require('mkdirp');
|
||||
const glob = require('glob');
|
||||
const readMetadata = require('./server/readMetadata.js');
|
||||
const path = require('path');
|
||||
const siteConfig = require(CWD + '/siteConfig.js');
|
||||
const babylon = require('babylon');
|
||||
const traverse = require('babel-traverse').default;
|
||||
const babylon = require('babylon');
|
||||
const fs = require('fs-extra');
|
||||
const glob = require('glob');
|
||||
const mkdirp = require('mkdirp');
|
||||
const nodePath = require('path');
|
||||
|
||||
const readMetadata = require('./server/readMetadata.js');
|
||||
const CWD = process.cwd();
|
||||
const siteConfig = require(CWD + '/siteConfig.js');
|
||||
const sidebars = require(CWD + '/sidebars.json');
|
||||
|
||||
let customTranslations = {
|
||||
|
@ -46,10 +47,10 @@ function execute() {
|
|||
};
|
||||
|
||||
// look through markdown headers of docs for titles and categories to translate
|
||||
const docsDir = path.join(CWD, '../', readMetadata.getDocsPath());
|
||||
const docsDir = nodePath.join(CWD, '../', readMetadata.getDocsPath());
|
||||
let files = glob.sync(CWD + '/../' + readMetadata.getDocsPath() + '/**');
|
||||
files.forEach(file => {
|
||||
const extension = path.extname(file);
|
||||
const extension = nodePath.extname(file);
|
||||
if (extension === '.md' || extension === '.markdown') {
|
||||
let res;
|
||||
try {
|
||||
|
@ -115,7 +116,7 @@ function execute() {
|
|||
// go through pages to look for text inside translate tags
|
||||
files = glob.sync(CWD + '/pages/en/**');
|
||||
files.forEach(file => {
|
||||
const extension = path.extname(file);
|
||||
const extension = nodePath.extname(file);
|
||||
if (extension === '.js') {
|
||||
const ast = babylon.parse(fs.readFileSync(file, 'utf8'), {
|
||||
plugins: ['jsx'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue