Skip to content
Snippets Groups Projects
Commit 49f0ec98 authored by Alexander Rose's avatar Alexander Rose
Browse files

check js files as well with eslint

- moved ts eslint config into overrides
parent a60d6e92
No related branches found
No related tags found
No related merge requests found
......@@ -3,60 +3,21 @@
"browser": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["tsconfig.json", "tsconfig.commonjs.json"],
"sourceType": "module"
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true
}
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/class-name-casing": "off",
"indent": "off",
"@typescript-eslint/indent": [
"error",
4
],
"@typescript-eslint/member-delimiter-style": [
"off",
{
"multiline": {
"delimiter": "none",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/prefer-namespace-keyword": "warn",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"@typescript-eslint/semi": [
"off",
null
],
"@typescript-eslint/type-annotation-spacing": "error",
"arrow-parens": [
"off",
"as-needed"
],
"brace-style": "off",
"@typescript-eslint/brace-style": [
"error",
"1tbs", { "allowSingleLine": true }
],
"comma-spacing": "off",
"@typescript-eslint/comma-spacing": "error",
"space-infix-ops": "error",
"comma-dangle": "off",
"eqeqeq": [
......@@ -71,5 +32,58 @@
"no-var": "error",
"spaced-comment": "error",
"semi": "warn"
}
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["tsconfig.json", "tsconfig.commonjs.json"],
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/indent": [
"error",
4
],
"@typescript-eslint/member-delimiter-style": [
"off",
{
"multiline": {
"delimiter": "none",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/prefer-namespace-keyword": "warn",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"@typescript-eslint/semi": [
"off",
null
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/brace-style": [
"error",
"1tbs", { "allowSingleLine": true }
],
"@typescript-eslint/comma-spacing": "error"
}
}
]
}
\ No newline at end of file
......@@ -11,8 +11,8 @@
"url": "https://github.com/molstar/molstar/issues"
},
"scripts": {
"lint": "eslint ./**/*.{ts,tsx}",
"lint-fix": "eslint ./**/*.{ts,tsx} --fix",
"lint": "eslint .",
"lint-fix": "eslint . --fix",
"test": "npm run lint && jest",
"build": "npm run build-tsc && npm run build-extra && npm run build-webpack",
"build-viewer": "npm run build-tsc && npm run build-extra && npm run build-webpack-viewer",
......
......@@ -4,40 +4,40 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
const git = require('simple-git')
const path = require('path')
const fs = require("fs")
const fse = require("fs-extra")
const git = require('simple-git');
const path = require('path');
const fs = require("fs");
const fse = require("fs-extra");
const remoteUrl = "https://github.com/molstar/molstar.github.io.git"
const buildDir = path.resolve(__dirname, '../build/')
const deployDir = path.resolve(buildDir, 'deploy/')
const localPath = path.resolve(deployDir, 'molstar.github.io/')
const remoteUrl = "https://github.com/molstar/molstar.github.io.git";
const buildDir = path.resolve(__dirname, '../build/');
const deployDir = path.resolve(buildDir, 'deploy/');
const localPath = path.resolve(deployDir, 'molstar.github.io/');
function log(command, stdout, stderr) {
if (command) {
console.log('\n###', command)
stdout.pipe(process.stdout)
stderr.pipe(process.stderr)
console.log('\n###', command);
stdout.pipe(process.stdout);
stderr.pipe(process.stderr);
}
}
function copyViewer() {
console.log('\n###', 'copy viewer files')
const viewerBuildPath = path.resolve(buildDir, '../build/viewer/')
const viewerDeployPath = path.resolve(localPath, 'viewer/')
fse.copySync(viewerBuildPath, viewerDeployPath, { overwrite: true })
console.log('\n###', 'copy viewer files');
const viewerBuildPath = path.resolve(buildDir, '../build/viewer/');
const viewerDeployPath = path.resolve(localPath, 'viewer/');
fse.copySync(viewerBuildPath, viewerDeployPath, { overwrite: true });
}
if (!fs.existsSync(localPath)) {
console.log('\n###', 'create localPath')
fs.mkdirSync(localPath, { recursive: true })
console.log('\n###', 'create localPath');
fs.mkdirSync(localPath, { recursive: true });
}
process.chdir(localPath);
if (!fs.existsSync(path.resolve(localPath, '.git/'))) {
console.log('\n###', 'clone repository')
console.log('\n###', 'clone repository');
git()
.outputHandler(log)
.clone(remoteUrl, localPath)
......@@ -45,9 +45,9 @@ if (!fs.existsSync(path.resolve(localPath, '.git/'))) {
.exec(copyViewer)
.add(['-A'])
.commit('updated viewer')
.push()
.push();
} else {
console.log('\n###', 'update repository')
console.log('\n###', 'update repository');
git()
.outputHandler(log)
.fetch(['--all'])
......@@ -55,5 +55,5 @@ if (!fs.existsSync(path.resolve(localPath, '.git/'))) {
.exec(copyViewer)
.add(['-A'])
.commit('updated viewer')
.push()
.push();
}
\ No newline at end of file
......@@ -53,7 +53,7 @@ const sharedConfig = {
aggregateTimeout: 750
},
devtool: ''
}
};
function createEntry(src, outFolder, outFilename, isNode) {
return {
......@@ -62,7 +62,7 @@ function createEntry(src, outFolder, outFilename, isNode) {
entry: path.resolve(__dirname, `lib/${src}.js`),
output: { filename: `${outFilename}.js`, path: path.resolve(__dirname, `build/${outFolder}`) },
...sharedConfig
}
};
}
function createEntryPoint(name, dir, out, library) {
......@@ -71,7 +71,7 @@ function createEntryPoint(name, dir, out, library) {
entry: path.resolve(__dirname, `lib/${dir}/${name}.js`),
output: { filename: `${library || name}.js`, path: path.resolve(__dirname, `build/${out}`), library: library || out, libraryTarget: 'umd' },
...sharedConfig
}
};
}
function createNodeEntryPoint(name, dir, out) {
......@@ -86,13 +86,13 @@ function createNodeEntryPoint(name, dir, out) {
xhr2: 'require("xhr2")',
},
...sharedConfig
}
};
}
function createApp(name, library) { return createEntryPoint('index', `apps/${name}`, name, library) }
function createExample(name) { return createEntry(`examples/${name}/index`, `examples/${name}`, 'index') }
function createBrowserTest(name) { return createEntryPoint(name, 'tests/browser', 'tests') }
function createNodeApp(name) { return createNodeEntryPoint('index', `apps/${name}`, name) }
function createApp(name, library) { return createEntryPoint('index', `apps/${name}`, name, library); }
function createExample(name) { return createEntry(`examples/${name}/index`, `examples/${name}`, 'index'); }
function createBrowserTest(name) { return createEntryPoint(name, 'tests/browser', 'tests'); }
function createNodeApp(name) { return createNodeEntryPoint('index', `apps/${name}`, name); }
module.exports = {
createApp,
......@@ -101,4 +101,4 @@ module.exports = {
createBrowserTest,
createNodeEntryPoint,
createNodeApp
}
\ No newline at end of file
};
\ No newline at end of file
......@@ -13,4 +13,4 @@ module.exports = [
createApp('docking-viewer', 'molstar'),
...examples.map(createExample),
...tests.map(createBrowserTest)
]
\ No newline at end of file
];
\ No newline at end of file
......@@ -6,4 +6,4 @@ module.exports = [
createApp('viewer', 'molstar'),
createApp('docking-viewer', 'molstar'),
...examples.map(createExample)
]
\ No newline at end of file
];
\ No newline at end of file
......@@ -4,4 +4,4 @@ module.exports = [
...createViewer,
devtool: 'eval'
}
]
\ No newline at end of file
];
\ No newline at end of file
......@@ -2,4 +2,4 @@ const common = require('./webpack.config.common.js');
const createApp = common.createApp;
module.exports = [
createApp('viewer', 'molstar')
]
\ No newline at end of file
];
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment