Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply new ESLint rules #1055

Merged
merged 5 commits into from
Jul 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ root = true

[*]
charset = utf-8
indent_style = tab
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
130 changes: 130 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"env": {
"browser": true,
"es6": true
},
"extends": [
"plugin:vue/recommended",
"airbnb-base"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"vue"
],
"rules": {
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"space-before-function-paren": [
2,
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"prefer-template": 1,
"arrow-parens": [
2,
"as-needed"
],
"max-len": 0,
"consistent-return": [
2,
{
"treatUndefinedAsUnspecified": true
}
],
"no-param-reassign": [
2,
{
"props": false
}
],
"no-return-assign": [
2,
"except-parens"
],
"linebreak-style": 0,
"quote-props": [
1,
"consistent-as-needed"
],
"no-tabs": [
2,
{
"allowIndentationTabs": true
}
],
"no-use-before-define": [
2,
{
"functions": false
}
],
"no-unused-vars": [
1,
{
"vars": "local",
"args": "none"
}
],
"no-await-in-loop": 0,
"no-shadow": 0,
"no-plusplus": 0,
"no-continue": 0,
"no-console": 0,
"no-alert": 0,
"no-underscore-dangle": 0,
"vue/script-indent": [
2,
2,
{
"baseIndent": 1,
"switchCase": 1
}
],
"vue/html-indent": [
2,
2
],
"vue/name-property-casing": [
2,
"kebab-case"
],
"vue/max-attributes-per-line": 0,
"vue/html-self-closing": [
2,
{
"html": {
"void": "never",
"normal": "never",
"component": "never"
}
}
],
"vue/singleline-html-element-content-newline": 0,
"vue/comma-dangle": 2
},
"overrides": [
{
"files": [
"*.vue"
],
"rules": {
"indent": 0
}
}
]
}
49 changes: 0 additions & 49 deletions .eslintrc.json

This file was deleted.

106 changes: 54 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,56 @@
{
"name": "asf-ui",
"version": "0.0.0",
"description": "Standalone web interface for ASF",
"scripts": {
"start": "webpack-dev-server --hot --open",
"build": "webpack --config webpack.config.prod.js",
"build:analyze": "webpack --config webpack.config.analyze.js",
"deploy": "webpack --config webpack.config.deploy.js"
},
"private": true,
"devDependencies": {
"@babel/core": "^7.10.5",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.10.4",
"babel-loader": "^8.1.0",
"before-build-webpack": "^0.2.9",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.0.3",
"css-loader": "^4.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-vue": "^6.2.2",
"file-loader": "^6.0.0",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"url-loader": "^4.1.0",
"vue-loader": "^15.9.3",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.44.0",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-brands-svg-icons": "^5.14.0",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/vue-fontawesome": "^0.1.10",
"axios": "^0.19.2",
"copy-to-clipboard": "^3.3.1",
"flat": "^5.0.0",
"humanize-duration": "^3.23.1",
"lodash-es": "^4.17.15",
"plurals-cldr": "^1.0.4",
"svg-country-flags": "^1.2.7",
"vue": "^2.6.11",
"vue-meta": "^2.4.0",
"vue-router": "^3.3.4",
"vue-snotify": "^3.2.1",
"vuex": "^3.5.1"
}
"name": "asf-ui",
"version": "0.0.0",
"description": "Standalone web interface for ASF",
"scripts": {
"start": "webpack-dev-server --hot --open",
"lint": "eslint --ext .vue,.js src scripts",
"lint-fix": "eslint --ext .vue,.js src scripts --fix",
"build": "webpack --config webpack.config.prod.js",
"build:analyze": "webpack --config webpack.config.analyze.js",
"deploy": "webpack --config webpack.config.deploy.js"
},
"private": true,
"devDependencies": {
"@babel/core": "^7.10.5",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.10.4",
"babel-loader": "^8.1.0",
"before-build-webpack": "^0.2.9",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^6.0.3",
"css-loader": "^4.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-vue": "^6.2.2",
"file-loader": "^6.0.0",
"sass": "^1.26.10",
"sass-loader": "^9.0.2",
"url-loader": "^4.1.0",
"vue-loader": "^15.9.3",
"vue-template-compiler": "^2.6.11",
"webpack": "^4.44.0",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-brands-svg-icons": "^5.14.0",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/vue-fontawesome": "^0.1.10",
"axios": "^0.19.2",
"copy-to-clipboard": "^3.3.1",
"flat": "^5.0.0",
"humanize-duration": "^3.23.1",
"lodash-es": "^4.17.15",
"plurals-cldr": "^1.0.4",
"svg-country-flags": "^1.2.7",
"vue": "^2.6.11",
"vue-meta": "^2.4.0",
"vue-router": "^3.3.4",
"vue-snotify": "^3.2.1",
"vuex": "^3.5.1"
}
}
18 changes: 9 additions & 9 deletions scripts/generateFlags.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
const fs = require('fs');

module.exports = function generateFlags() {
const files = fs.readdirSync('./src/i18n/locale');
const files = fs.readdirSync('./src/i18n/locale');

const countries = files
.filter(fileName => fileName.endsWith('.json'))
.map(fileName => fileName === 'default.json' ? 'en-US' : fileName.replace('.json', ''))
.map(locale => locale === 'sr-CS' ? 'rs' : locale.split('-')[1].toLowerCase());
const countries = files
.filter(fileName => fileName.endsWith('.json'))
.map(fileName => (fileName === 'default.json' ? 'en-US' : fileName.replace('.json', '')))
.map(locale => (locale === 'sr-CS' ? 'rs' : locale.split('-')[1].toLowerCase()));

const fileContent = countries
.map(country => `export { default as ${country} } from 'svg-country-flags/png100px/${country}.png';`)
.join('\n');
const fileContent = countries
.map(country => `export { default as ${country} } from 'svg-country-flags/png100px/${country}.png';`)
.join('\n');

fs.writeFileSync('./generated/flags.js', fileContent);
fs.writeFileSync('./generated/flags.js', fileContent);
};
10 changes: 5 additions & 5 deletions scripts/getCommitHash.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { execSync } = require('child_process');

module.exports = function getCommitHash() {
try {
return execSync('git rev-parse --short HEAD').toString();
} catch (err) {
return '0000000';
}
try {
return execSync('git rev-parse --short HEAD').toString();
} catch (err) {
return '0000000';
}
};
Loading