Use eslint instead of jshint.
This commit is contained in:
parent
8874c88222
commit
f2589dc2a1
30
.eslintrc.json
Normal file
30
.eslintrc.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"globals": {
|
||||||
|
"OV": "writable",
|
||||||
|
"$": "readonly",
|
||||||
|
"THREE": "readonly",
|
||||||
|
"rhino3dm": "readonly",
|
||||||
|
"IfcAPI": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 12
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-var": "error",
|
||||||
|
"guard-for-in": "error",
|
||||||
|
"no-use-before-define": "error",
|
||||||
|
"no-new": "error",
|
||||||
|
"quotes": ["error", "single"],
|
||||||
|
"block-scoped-var": "error",
|
||||||
|
"no-loop-func": "error",
|
||||||
|
"no-undef": "error",
|
||||||
|
"no-extend-native": "error",
|
||||||
|
"eqeqeq": "error",
|
||||||
|
"no-unused-vars": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
42
.jshintrc
42
.jshintrc
@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
"esversion" : 6,
|
|
||||||
"curly" : true,
|
|
||||||
"forin" : true,
|
|
||||||
"latedef" : true,
|
|
||||||
"nonew" : true,
|
|
||||||
"quotmark" : true,
|
|
||||||
"funcscope" : true,
|
|
||||||
"lastsemic" : true,
|
|
||||||
"loopfunc" : true,
|
|
||||||
"shadow" : false,
|
|
||||||
"undef" : true,
|
|
||||||
"unused" : false,
|
|
||||||
"bitwise" : false,
|
|
||||||
"freeze" : true,
|
|
||||||
"leanswitch" : true,
|
|
||||||
"eqeqeq" : true,
|
|
||||||
"futurehostile" : true,
|
|
||||||
"regexpu" : true,
|
|
||||||
"varstmt" : true,
|
|
||||||
"globals" : {
|
|
||||||
"OV" : true,
|
|
||||||
"THREE" : false,
|
|
||||||
"rhino3dm" : false,
|
|
||||||
"IfcAPI" : false,
|
|
||||||
"TextEncoder" : false,
|
|
||||||
"TextDecoder" : false,
|
|
||||||
"XMLHttpRequest" : false,
|
|
||||||
"FileReader" : false,
|
|
||||||
"Blob" : false,
|
|
||||||
"URL" : false,
|
|
||||||
"window" : false,
|
|
||||||
"document" : false,
|
|
||||||
"setTimeout" : false,
|
|
||||||
"requestAnimationFrame" : false,
|
|
||||||
"getComputedStyle" : false,
|
|
||||||
"alert" : false,
|
|
||||||
"atob" : false,
|
|
||||||
"console" : false,
|
|
||||||
"$" : false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
package.json
11
package.json
@ -5,13 +5,13 @@
|
|||||||
"repository": "github:kovacsv/Online3DViewer",
|
"repository": "github:kovacsv/Online3DViewer",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"http-server": "^0.12.3",
|
"eslint": "^7.30.0",
|
||||||
"google-closure-compiler": "^20210302.0.0",
|
"google-closure-compiler": "^20210302.0.0",
|
||||||
"jshint": "^2.12.0",
|
"http-server": "^0.12.3",
|
||||||
"mocha": "^8.3.2",
|
"mocha": "^8.3.2",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
"rewire": "^5.0.0",
|
"rewire": "^5.0.0",
|
||||||
"svgo": "^2.2.2",
|
"svgo": "^2.2.2"
|
||||||
"nyc": "^15.1.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha test",
|
"test": "mocha test",
|
||||||
@ -19,5 +19,6 @@
|
|||||||
"build": "node tools/run_python.js tools/create_package.py",
|
"build": "node tools/run_python.js tools/create_package.py",
|
||||||
"update": "node tools/run_python.js tools/update_includes.py",
|
"update": "node tools/run_python.js tools/update_includes.py",
|
||||||
"svg": "node tools/run_python.js tools/optimize_svg_files.py"
|
"svg": "node tools/run_python.js tools/optimize_svg_files.py"
|
||||||
}
|
},
|
||||||
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,3 @@ OV.ValueOrDefault = function (val, def)
|
|||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
OV.EnumerateKeyValuePairs = function (arr, proc)
|
|
||||||
{
|
|
||||||
for (let key in arr) {
|
|
||||||
if (arr.hasOwnProperty (key)) {
|
|
||||||
proc (key, arr[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
4
source/external/ifcimporter.js
vendored
4
source/external/ifcimporter.js
vendored
@ -3,7 +3,7 @@ OV.ImporterIfc = class extends OV.ImporterBase
|
|||||||
constructor ()
|
constructor ()
|
||||||
{
|
{
|
||||||
super ();
|
super ();
|
||||||
this.ifc = null;
|
this.ifc = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CanImportExtension (extension)
|
CanImportExtension (extension)
|
||||||
@ -14,7 +14,7 @@ OV.ImporterIfc = class extends OV.ImporterBase
|
|||||||
GetKnownFileFormats ()
|
GetKnownFileFormats ()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
'ifc' : OV.FileFormat.Binary
|
'ifc' : OV.FileFormat.Binary
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
source/external/rhinoimporter.js
vendored
2
source/external/rhinoimporter.js
vendored
@ -14,7 +14,7 @@ OV.Importer3dm = class extends OV.ImporterBase
|
|||||||
GetKnownFileFormats ()
|
GetKnownFileFormats ()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
'3dm' : OV.FileFormat.Binary
|
'3dm' : OV.FileFormat.Binary
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -510,7 +510,7 @@ OV.ImporterGltf = class extends OV.ImporterBase
|
|||||||
{
|
{
|
||||||
let propertyGroup = new OV.PropertyGroup ('Asset properties');
|
let propertyGroup = new OV.PropertyGroup ('Asset properties');
|
||||||
for (let propertyName in gltf.asset) {
|
for (let propertyName in gltf.asset) {
|
||||||
if (gltf.asset.hasOwnProperty (propertyName)) {
|
if (Object.prototype.hasOwnProperty.call (gltf.asset, propertyName)) {
|
||||||
if (typeof gltf.asset[propertyName] === 'string') {
|
if (typeof gltf.asset[propertyName] === 'string') {
|
||||||
const property = new OV.Property (OV.PropertyType.Text, propertyName, gltf.asset[propertyName]);
|
const property = new OV.Property (OV.PropertyType.Text, propertyName, gltf.asset[propertyName]);
|
||||||
propertyGroup.AddProperty (property);
|
propertyGroup.AddProperty (property);
|
||||||
|
|||||||
@ -18,8 +18,8 @@ def GetVersion (rootDir):
|
|||||||
packageJson = json.load (packageJsonFile)
|
packageJson = json.load (packageJsonFile)
|
||||||
return packageJson['version']
|
return packageJson['version']
|
||||||
|
|
||||||
def JSHintFolder (folder):
|
def ESLintFolder (folder):
|
||||||
result = Tools.RunCommand ('jshint', [folder])
|
result = Tools.RunCommand ('eslint', [folder])
|
||||||
if result != 0:
|
if result != 0:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -125,16 +125,16 @@ def Main (argv):
|
|||||||
with open ('config.json') as configJson:
|
with open ('config.json') as configJson:
|
||||||
config = json.load (configJson)
|
config = json.load (configJson)
|
||||||
|
|
||||||
PrintInfo ('JSHint importer sources.')
|
PrintInfo ('ESLint importer sources.')
|
||||||
jsHintResult = JSHintFolder (os.path.join (rootDir, 'source'))
|
esLintResult = ESLintFolder (os.path.join (rootDir, 'source'))
|
||||||
if not jsHintResult:
|
if not esLintResult:
|
||||||
PrintError ('JSHint importer sources failed.')
|
PrintError ('ESLint importer sources failed.')
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
PrintInfo ('JSHint website sources.')
|
PrintInfo ('ESLint website sources.')
|
||||||
jsHintResult = JSHintFolder (os.path.join (rootDir, 'website', 'o3dv'))
|
esLintResult = ESLintFolder (os.path.join (rootDir, 'website', 'o3dv'))
|
||||||
if not jsHintResult:
|
if not esLintResult:
|
||||||
PrintError ('JSHint website sources failed.')
|
PrintError ('ESLint website sources failed.')
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
version = GetVersion (rootDir)
|
version = GetVersion (rootDir)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
OV.FeatureSet =
|
OV.FeatureSet =
|
||||||
{
|
{
|
||||||
SettingsPanel : false
|
SettingsPanel : true
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user