1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 09:54:24 +04:00

Apply eslint 🍪

This commit is contained in:
Damian Sznajder
2019-06-17 21:43:15 +02:00
parent 9febb4be53
commit 497f238fd4
5 changed files with 96 additions and 103 deletions

View File

@@ -10,12 +10,11 @@ bs.init({
'/dist': 'dist', '/dist': 'dist',
'/libs': 'static/libs', '/libs': 'static/libs',
'/img': 'static/img', '/img': 'static/img',
} },
}, },
files: ['tmp/**/*', 'dist/css/*.css', 'dist/js/*.js'], files: ['tmp/**/*', 'dist/css/*.css', 'dist/js/*.js'],
watchOptions: { watchOptions: {
ignoreInitial: true ignoreInitial: true,
}, },
notify: false notify: false,
}); });

View File

@@ -4,7 +4,7 @@ const fs = require('fs'),
path = require('path'), path = require('path'),
yaml = require('yaml'); yaml = require('yaml');
const data = fs.readFileSync(path.resolve(__dirname, '../scss/fonts/_tabler-webfont.scss'), "utf8"), const data = fs.readFileSync(path.resolve(__dirname, '../scss/fonts/_tabler-webfont.scss'), 'utf8'),
re = /\$icon-([^\-\s]+)-([^:\s]+):\s'([^'\n]+)';/g; re = /\$icon-([^\-\s]+)-([^:\s]+):\s'([^'\n]+)';/g;
let items = {}; let items = {};
@@ -17,5 +17,4 @@ data.replace(re, function (match, g1, g2, g3) {
items[g1][g2] = g3; items[g1][g2] = g3;
}); });
fs.writeFileSync('pages/_data/icons.yml', yaml.stringify(items)); fs.writeFileSync('pages/_data/icons.yml', yaml.stringify(items));

View File

@@ -20,13 +20,13 @@ const plugins = [
'createClass', 'createClass',
'inheritsLoose', 'inheritsLoose',
'defineProperty', 'defineProperty',
'objectSpread' 'objectSpread',
] ],
}) }),
]; ];
const globals = { const globals = {
'popper.js': 'Popper' 'popper.js': 'Popper',
}; };
if (BUNDLE) { if (BUNDLE) {
@@ -43,10 +43,10 @@ const rollupConfig = {
banner, banner,
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`), file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
format: ESM ? 'esm' : 'umd', format: ESM ? 'esm' : 'umd',
globals globals,
}, },
external, external,
plugins plugins,
}; };
if (!ESM) { if (!ESM) {

View File

@@ -1,7 +1,7 @@
(function($) { (function($) {
$(document).ready(function() { $(document).ready(function() {
$().peity &&
$().peity && $('[data-spark]').each(function () { $('[data-spark]').each(function() {
const $this = $(this), const $this = $(this),
data = $this.attr('data-spark'), data = $this.attr('data-spark'),
color = $this.attr('data-spark-color') || 'blue', color = $this.attr('data-spark-color') || 'blue',
@@ -14,11 +14,11 @@
fillColor = tabler.colors[color]; fillColor = tabler.colors[color];
if (type === 'donut' || type === 'pie') { if (type === 'donut' || type === 'pie') {
fillColor = [fillColor, tabler.hexToRgbA(fillColor, .1)]; fillColor = [fillColor, tabler.hexToRgbA(fillColor, 0.1)];
} else if (type === 'bar') { } else if (type === 'bar') {
fillColor = [fillColor]; fillColor = [fillColor];
} else if (type === 'line') { } else if (type === 'line') {
fillColor = tabler.hexToRgbA(fillColor, .1); fillColor = tabler.hexToRgbA(fillColor, 0.1);
} }
$div.peity(type, { $div.peity(type, {
@@ -29,24 +29,19 @@
stroke: strokeColor, stroke: strokeColor,
strokeWidth: 2, strokeWidth: 2,
fill: fillColor, fill: fillColor,
padding: .2, padding: 0.2,
innerRadius: (type === 'donut') ? 17 : 0 innerRadius: type === 'donut' ? 17 : 0,
}); });
}); });
}); });
})(jQuery); })(jQuery);
/* /*
charts default configuration charts default configuration
*/ */
if (window.Apex) { if (window.Apex) {
const borderColor = 'rgba(0, 0, 0, 0.09)';
var borderColor = 'rgba(0, 0, 0, 0.09)'; const mutedColor = '#888e9a';
var mutedColor = '#888e9a';
window.Apex = { window.Apex = {
chart: { chart: {
@@ -56,11 +51,11 @@ if (window.Apex) {
show: false, show: false,
}, },
zoom: { zoom: {
enabled: false enabled: false,
}, },
animations: { animations: {
enabled: false, enabled: false,
} },
}, },
grid: { grid: {
@@ -71,8 +66,8 @@ if (window.Apex) {
right: 0, right: 0,
left: 0, left: 0,
bottom: 0, bottom: 0,
top: 0 top: 0,
} },
}, },
dataLabels: { dataLabels: {
@@ -100,7 +95,7 @@ if (window.Apex) {
fill: { fill: {
type: 'solid', type: 'solid',
opacity: 1 opacity: 1,
}, },
markers: { markers: {
@@ -109,7 +104,7 @@ if (window.Apex) {
radius: 2, radius: 2,
hover: { hover: {
size: 4, size: 4,
} },
}, },
legend: { legend: {
@@ -117,22 +112,22 @@ if (window.Apex) {
fontSize: '14px', fontSize: '14px',
markers: { markers: {
width: 8, width: 8,
height: 8 height: 8,
}, },
itemMargin: { itemMargin: {
horizontal: 0, horizontal: 0,
vertical: 8 vertical: 8,
}, },
}, },
title: { title: {
style: { style: {
fontSize: '14px', fontSize: '14px',
} },
}, },
tooltip: { tooltip: {
fillSeriesColor: false fillSeriesColor: false,
}, },
xaxis: { xaxis: {
@@ -140,27 +135,27 @@ if (window.Apex) {
style: { style: {
colors: mutedColor, colors: mutedColor,
fontSize: '12px', fontSize: '12px',
} },
}, },
tooltip: { tooltip: {
enabled: false enabled: false,
}, },
axisBorder: { axisBorder: {
color: borderColor, color: borderColor,
height: 0 height: 0,
}, },
axisTicks: { axisTicks: {
show: true, show: true,
height: 4, height: 4,
color: borderColor color: borderColor,
} },
}, },
yaxis: { yaxis: {
show: false, show: false,
labels: { labels: {
show: false show: false,
} },
} },
}; };
} }

View File

@@ -52,7 +52,7 @@ const tabler = {
return parseInt(h, 16); return parseInt(h, 16);
} }
weight = (typeof(weight) !== 'undefined') ? weight : 50; weight = typeof weight !== 'undefined' ? weight : 50;
let color = '#'; let color = '#';
@@ -74,8 +74,12 @@ const tabler = {
toggleFullscreen: function(elem) { toggleFullscreen: function(elem) {
elem = elem || document.documentElement; elem = elem || document.documentElement;
if (!document.fullscreenElement && !document.mozFullScreenElement && if (
!document.webkitFullscreenElement && !document.msFullscreenElement) { !document.fullscreenElement &&
!document.mozFullScreenElement &&
!document.webkitFullscreenElement &&
!document.msFullscreenElement
) {
if (elem.requestFullscreen) { if (elem.requestFullscreen) {
elem.requestFullscreen(); elem.requestFullscreen();
} else if (elem.msRequestFullscreen) { } else if (elem.msRequestFullscreen) {
@@ -96,10 +100,9 @@ const tabler = {
document.webkitExitFullscreen(); document.webkitExitFullscreen();
} }
} }
} },
}; };
$(document).ready(function() { $(document).ready(function() {
const $body = $('body'); const $body = $('body');
@@ -113,21 +116,18 @@ $(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover(); $('[data-toggle="popover"]').popover();
/* /*
Autosize plugin Autosize plugin
*/ */
if (window.autosize) { if (window.autosize) {
(function() { (function() {
const $elem = $('[data-toggle="autosize"]');
var $elem = $('[data-toggle="autosize"]');
if ($elem) { if ($elem) {
$elem.each(function() { $elem.each(function() {
autosize($(this)); autosize($(this));
}); });
} }
})(); })();
} }
@@ -136,14 +136,14 @@ $(document).ready(function () {
*/ */
if (window.IMask) { if (window.IMask) {
(function() { (function() {
var $elem = $('[data-mask]'); const $elem = $('[data-mask]');
if ($elem) { if ($elem) {
$elem.each(function() { $elem.each(function() {
IMask($(this).get(0), { IMask($(this).get(0), {
mask: $(this).attr('data-mask'), mask: $(this).attr('data-mask'),
lazy: $(this).attr('data-mask-visible') === 'true' lazy: $(this).attr('data-mask-visible') === 'true',
}) });
}); });
} }
})(); })();
@@ -153,7 +153,7 @@ $(document).ready(function () {
* Seelectize plugin * Seelectize plugin
*/ */
if (jQuery && jQuery().selectize) { if (jQuery && jQuery().selectize) {
var $elem = $('[data-selectize]'); const $elem = $('[data-selectize]');
if ($elem) { if ($elem) {
$elem.selectize(); $elem.selectize();