Switch from jshint to eslint
This commit is contained in:
parent
a05dc21977
commit
9f30b25d3e
19
.babelrc
19
.babelrc
|
|
@ -1,11 +1,18 @@
|
||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
["env", {
|
[
|
||||||
"targets": {
|
"env",
|
||||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
{
|
||||||
},
|
"targets": {
|
||||||
"modules": false
|
"browsers": [
|
||||||
}]
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not ie <= 8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"modules": false
|
||||||
|
}
|
||||||
|
]
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"external-helpers"
|
"external-helpers"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
module.exports = {
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"warn",
|
||||||
|
"tab",
|
||||||
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"double"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"no-console": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
allow: ["warn", "error"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"args": "none"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,7 +7,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c tools/rollup.default.js && rollup -c tools/rollup.min.js && rollup -c tools/rollup.babel.js && rollup -c tools/rollup.babel.min.js",
|
"build": "rollup -c tools/rollup.default.js && rollup -c tools/rollup.min.js && rollup -c tools/rollup.babel.js && rollup -c tools/rollup.babel.min.js",
|
||||||
"prepare": "npm test && rm -rf build && npm run build",
|
"prepare": "npm test && rm -rf build && npm run build",
|
||||||
"test": "jshint src"
|
"test": "eslint src/** tools/**"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
"babel-cli": "^6.26.0",
|
"babel-cli": "^6.26.0",
|
||||||
"babel-plugin-external-helpers": "^6.22.0",
|
"babel-plugin-external-helpers": "^6.22.0",
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"jshint": "^2.9.5",
|
"eslint": "^4.14.0",
|
||||||
"rollup": "^0.50.0",
|
"rollup": "^0.50.0",
|
||||||
"rollup-plugin-babel": "^3.0.2",
|
"rollup-plugin-babel": "^3.0.2",
|
||||||
"rollup-plugin-uglify": "^2.0.1",
|
"rollup-plugin-uglify": "^2.0.1",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import { SkinObject, CapeObject, PlayerObject } from "./skinview3d";
|
|
||||||
|
|
||||||
let WalkAnimation = (player, time) => {
|
let WalkAnimation = (player, time) => {
|
||||||
let skin = player.skin;
|
let skin = player.skin;
|
||||||
let angleRot = time + Math.PI / 2;
|
let angleRot = time + Math.PI / 2;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import THREE from "three";
|
import THREE from "three";
|
||||||
import { SkinObject, CapeObject, PlayerObject } from "./model";
|
import { PlayerObject } from "./model";
|
||||||
import { OrbitControls } from "./orbit_controls";
|
import { OrbitControls } from "./orbit_controls";
|
||||||
|
|
||||||
function copyImage(context, sX, sY, w, h, dX, dY, flipHorizontal) {
|
function copyImage(context, sX, sY, w, h, dX, dY, flipHorizontal) {
|
||||||
|
|
@ -95,14 +95,14 @@ class SkinViewer {
|
||||||
|
|
||||||
// texture loading
|
// texture loading
|
||||||
this.skinImg.crossOrigin = "";
|
this.skinImg.crossOrigin = "";
|
||||||
this.skinImg.onerror = () => console.log("Failed loading " + this.skinImg.src);
|
this.skinImg.onerror = () => console.error("Failed loading " + this.skinImg.src);
|
||||||
this.skinImg.onload = () => {
|
this.skinImg.onload = () => {
|
||||||
let isOldFormat = false;
|
let isOldFormat = false;
|
||||||
if (this.skinImg.width !== this.skinImg.height) {
|
if (this.skinImg.width !== this.skinImg.height) {
|
||||||
if (this.skinImg.width === 2 * this.skinImg.height) {
|
if (this.skinImg.width === 2 * this.skinImg.height) {
|
||||||
isOldFormat = true;
|
isOldFormat = true;
|
||||||
} else {
|
} else {
|
||||||
console.log("Bad skin size");
|
console.error("Bad skin size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -130,10 +130,10 @@ class SkinViewer {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.capeImg.crossOrigin = "";
|
this.capeImg.crossOrigin = "";
|
||||||
this.capeImg.onerror = () => console.log("Failed loading " + this.capeImg.src);
|
this.capeImg.onerror = () => console.error("Failed loading " + this.capeImg.src);
|
||||||
this.capeImg.onload = () => {
|
this.capeImg.onload = () => {
|
||||||
if (this.capeImg.width !== 2 * this.capeImg.height) {
|
if (this.capeImg.width !== 2 * this.capeImg.height) {
|
||||||
console.log("Bad cape size");
|
console.error("Bad cape size");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
import { buildType } from './rollup.common';
|
import { buildType } from "./rollup.common";
|
||||||
export default buildType({ postfix: '.babel', babel: true, uglify: false });
|
export default buildType({ postfix: ".babel", babel: true, uglify: false });
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
import { buildType } from './rollup.common';
|
import { buildType } from "./rollup.common";
|
||||||
export default buildType({ postfix: '.babel.min', babel: true, uglify: true });
|
export default buildType({ postfix: ".babel.min", babel: true, uglify: true });
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
import uglify from 'rollup-plugin-uglify';
|
import uglify from "rollup-plugin-uglify";
|
||||||
import { minify } from 'uglify-es';
|
import { minify } from "uglify-es";
|
||||||
import babel from 'rollup-plugin-babel';
|
import babel from "rollup-plugin-babel";
|
||||||
let buildType = config => {
|
let buildType = config => {
|
||||||
let options = {
|
let options = {
|
||||||
input: 'src/skinview3d.js',
|
input: "src/skinview3d.js",
|
||||||
indent: '\t',
|
indent: "\t",
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
external: ['three'],
|
external: ["three"],
|
||||||
globals: {
|
globals: {
|
||||||
three: 'THREE'
|
three: "THREE"
|
||||||
},
|
},
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
format: 'umd',
|
format: "umd",
|
||||||
name: 'skinview3d',
|
name: "skinview3d",
|
||||||
file: `build/skinview3d${config.postfix}.js`
|
file: `build/skinview3d${config.postfix}.js`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
format: 'es',
|
format: "es",
|
||||||
file: `build/skinview3d${config.postfix}.module.js`
|
file: `build/skinview3d${config.postfix}.module.js`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -26,7 +26,7 @@ let buildType = config => {
|
||||||
if (config.babel) {
|
if (config.babel) {
|
||||||
options.plugins.push(
|
options.plugins.push(
|
||||||
babel({
|
babel({
|
||||||
exclude: 'node_modules/**',
|
exclude: "node_modules/**",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
import { buildType } from './rollup.common';
|
import { buildType } from "./rollup.common";
|
||||||
export default buildType({ postfix: '', babel: false, uglify: false });
|
export default buildType({ postfix: "", babel: false, uglify: false });
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
import { buildType } from './rollup.common';
|
import { buildType } from "./rollup.common";
|
||||||
export default buildType({ postfix: '.min', babel: false, uglify: true });
|
export default buildType({ postfix: ".min", babel: false, uglify: true });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue