пофиксил ошибку eslint, где ругался на отсутствие конфига babel

This commit is contained in:
Norbaev 2024-06-25 16:42:17 +05:00
parent d88130a038
commit 599a93fe5b
7 changed files with 206 additions and 173 deletions

View File

@ -7,12 +7,14 @@ module.exports = {
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 2021, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
sourceType: 'module', // Allows for the use of imports
// requireConfigFile: false,
babelOptions: { configFile: './babel.config.cjs' },
},
env: {
browser: true,
'vue/setup-compiler-macros': true
'vue/setup-compiler-macros': true,
},
// Rules order is important, please avoid shuffling them
@ -30,14 +32,12 @@ module.exports = {
// 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
// 'standard'
],
plugins: [
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
// required to lint *.vue files
'vue',
],
globals: {
@ -50,12 +50,11 @@ module.exports = {
__QUASAR_SSR_PWA__: 'readonly',
process: 'readonly',
Capacitor: 'readonly',
chrome: 'readonly'
chrome: 'readonly',
},
// add your custom rules here
rules: {
// allow async-await
'generator-star-spacing': 'off',
// allow paren-less arrow functions
@ -82,6 +81,6 @@ module.exports = {
'vue/no-v-for-template-key': 'warn',
'vue/multi-word-component-names': 'off',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
}
}
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
};

3
client/.prettierrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
singleQuote: true,
};

View File

@ -1,14 +1,14 @@
/* eslint-disable */
module.exports = api => {
module.exports = (api) => {
return {
presets: [
[
'@quasar/babel-preset-app',
api.caller(caller => caller && caller.target === 'node')
api.caller((caller) => caller && caller.target === 'node')
? { targets: { node: 'current' } }
: {}
]
]
}
}
: {},
],
],
};
};

View File

@ -50,6 +50,7 @@
"postcss-nested": "^6.0.1",
"postcss-preset-env": "^9.2.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "^3.3.2",
"sass-loader": "^13.3.2",
"vue-loader": "^17.3.0"
},
@ -12808,6 +12809,21 @@
"node": ">= 0.8.0"
}
},
"node_modules/prettier": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz",
"integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==",
"dev": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/pretty-error": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz",
@ -24507,6 +24523,12 @@
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true
},
"prettier": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz",
"integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==",
"dev": true
},
"pretty-error": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz",

View File

@ -59,6 +59,7 @@
"postcss-nested": "^6.0.1",
"postcss-preset-env": "^9.2.0",
"postcss-simple-vars": "^7.0.1",
"prettier": "^3.3.2",
"sass-loader": "^13.3.2",
"vue-loader": "^17.3.0"
},

View File

@ -1,7 +1,9 @@
const path = require('path');
const webpack = require('webpack');
const path = require("path");
const webpack = require("webpack");
const nodeExternals = require("webpack-node-externals");
const env = require('dotenv').config({ path: `.env.${process.env.NODE_ENV.toLowerCase()}` }).parsed;
const env = require("dotenv").config({
path: `.env.${process.env.NODE_ENV.toLowerCase()}`,
}).parsed;
/* eslint-env node */
/*
@ -12,8 +14,8 @@ const env = require('dotenv').config({ path: `.env.${process.env.NODE_ENV.toLowe
// Configuration for your app
// https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js
const ESLintPlugin = require('eslint-webpack-plugin')
const { configure } = require('quasar/wrappers')
const ESLintPlugin = require("eslint-webpack-plugin");
const { configure } = require("quasar/wrappers");
module.exports = configure(function (ctx) {
return {
// https://v2.quasar.dev/quasar-cli-webpack/supporting-ts
@ -26,9 +28,9 @@ module.exports = configure(function (ctx) {
// --> boot files are part of "main.js"
// https://v2.quasar.dev/quasar-cli-webpack/boot-files
boot: [
'main',
'directive',
{ path: 'store', server: false },
"main",
"directive",
{ path: "store", server: false },
//{ path: 'directive', server: false },
//'axios'
],
@ -47,16 +49,15 @@ module.exports = configure(function (ctx) {
// 'themify',
// 'line-awesome',
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
// 'roboto-font', // optional, you are not bound to it
// 'material-icons' // optional, you are not bound to it
],
// Full list of options: https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js#Property%3A-build
build: {
vueRouterMode: 'history', // available values: 'hash', 'history'
vueRouterMode: "history", // available values: 'hash', 'history'
env: {
...process.env
...process.env,
},
// transpile: false,
// publicPath: '/',
@ -79,8 +80,9 @@ module.exports = configure(function (ctx) {
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
chainWebpack(chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js', 'vue'] }])
chain
.plugin("eslint-webpack-plugin")
.use(ESLintPlugin, [{ extensions: ["js", "vue"] }]);
// chain.plugin('normal-module-replacement').use(
// new webpack.NormalModuleReplacementPlugin(/settings$/, function(resource) {
// resource.request = resource.request.replace(/settings$/, `settings/${process.env.NODE_ENV}`);
@ -91,43 +93,45 @@ module.exports = configure(function (ctx) {
// chain.plugin('robotstxt-webpack-plugin')
// .use(new RobotstxtPlugin(settings.robotsTxt))
chain.module.rule('images')
chain.module
.rule("images")
.test(/\.(png|jpe?g|gif|svg|webp|avif|ico)(\?.*)?$/)
.type('javascript/auto')
.use('url-loader')
.loader('url-loader')
.type("javascript/auto")
.use("url-loader")
.loader("url-loader")
.options({
esModule: false,
limit: 16384,
name: `assets/img/[name].[hash:8].[ext]`
})
chain.module.rule('videos')
name: `assets/img/[name].[hash:8].[ext]`,
});
chain.module
.rule("videos")
.test(/\.(mp4|webm|mov)(\?.*)?$/)
.type('javascript/auto')
.use('url-loader')
.loader('url-loader')
.type("javascript/auto")
.use("url-loader")
.loader("url-loader")
.options({
esModule: false,
limit: 32768,
name: `assets/media/[name].[hash:8].[ext]`
})
name: `assets/media/[name].[hash:8].[ext]`,
});
},
extendWebpack(cfg) {
cfg.resolve.alias = {
...cfg.resolve.alias,
'@': path.resolve(__dirname, './src'),
"@": path.resolve(__dirname, "./src"),
};
},
devtool: 'source-map'
devtool: "source-map",
},
// Full list of options: https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js#Property%3A-devServer
devServer: {
server: {
type: 'http'
type: "http",
},
port: 5173,
open: false // opens browser window automatically
open: false, // opens browser window automatically
},
// https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js#Property%3A-framework
@ -135,7 +139,7 @@ module.exports = configure(function (ctx) {
config: {},
// iconSet: 'material-icons', // Quasar icon set
lang: 'ru', // Quasar language pack
lang: "ru", // Quasar language pack
// For special cases outside of where the auto-import strategy can have an impact
// (like functional components as one of the examples),
@ -145,7 +149,7 @@ module.exports = configure(function (ctx) {
// directives: [],
// Quasar plugins
plugins: ['Meta']
plugins: ["Meta"],
},
// animations: 'all', // --- includes all animations
@ -189,65 +193,67 @@ module.exports = configure(function (ctx) {
// Tell browser when a file from the server should expire from cache (in ms)
chainWebpackWebserver(chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js'] }])
chain
.plugin("eslint-webpack-plugin")
.use(ESLintPlugin, [{ extensions: ["js"] }]);
},
middlewares: [
ctx.prod ? 'compression' : '',
'render' // keep this as last one
]
ctx.prod ? "compression" : "",
"render", // keep this as last one
],
},
// https://v2.quasar.dev/quasar-cli-webpack/developing-pwa/configuring-pwa
pwa: {
workboxPluginMode: 'GenerateSW', // 'GenerateSW' or 'InjectManifest'
workboxPluginMode: "GenerateSW", // 'GenerateSW' or 'InjectManifest'
workboxOptions: {}, // only for GenerateSW
// for the custom service worker ONLY (/src-pwa/custom-service-worker.[js|ts])
// if using workbox in InjectManifest mode
chainWebpackCustomSW(chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js'] }])
chain
.plugin("eslint-webpack-plugin")
.use(ESLintPlugin, [{ extensions: ["js"] }]);
},
manifest: {
name: 'Tugan App',
short_name: 'Tugan App',
description: 'A Tugan project',
display: 'standalone',
orientation: 'portrait',
background_color: '#ffffff',
theme_color: '#027be3',
name: "Tugan App",
short_name: "Tugan App",
description: "A Tugan project",
display: "standalone",
orientation: "portrait",
background_color: "#ffffff",
theme_color: "#027be3",
icons: [
{
src: 'icons/icon-128x128.png',
sizes: '128x128',
type: 'image/png'
src: "icons/icon-128x128.png",
sizes: "128x128",
type: "image/png",
},
{
src: 'icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
src: "icons/icon-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: 'icons/icon-256x256.png',
sizes: '256x256',
type: 'image/png'
src: "icons/icon-256x256.png",
sizes: "256x256",
type: "image/png",
},
{
src: 'icons/icon-384x384.png',
sizes: '384x384',
type: 'image/png'
src: "icons/icon-384x384.png",
sizes: "384x384",
type: "image/png",
},
{
src: 'icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
src: "icons/icon-512x512.png",
sizes: "512x512",
type: "image/png",
},
],
},
},
// Full list of options: https://v2.quasar.dev/quasar-cli-webpack/developing-cordova-apps/configuring-cordova
@ -257,22 +263,20 @@ module.exports = configure(function (ctx) {
// Full list of options: https://v2.quasar.dev/quasar-cli-webpack/developing-capacitor-apps/configuring-capacitor
capacitor: {
hideSplashscreen: true
hideSplashscreen: true,
},
// Full list of options: https://v2.quasar.dev/quasar-cli-webpack/developing-electron-apps/configuring-electron
electron: {
bundler: 'packager', // 'packager' or 'builder'
bundler: "packager", // 'packager' or 'builder'
packager: {
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
// OS X / Mac App Store
// appBundleId: '',
// appCategoryType: '',
// osxSign: '',
// protocol: 'myapp://path',
// Windows only
// win32metadata: { ... }
},
@ -280,21 +284,22 @@ module.exports = configure(function (ctx) {
builder: {
// https://www.electron.build/configuration/configuration
appId: 'tugan'
appId: "tugan",
},
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
chainWebpackMain(chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js'] }])
chain
.plugin("eslint-webpack-plugin")
.use(ESLintPlugin, [{ extensions: ["js"] }]);
},
chainWebpackPreload(chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js'] }])
}
}
}
})
chain
.plugin("eslint-webpack-plugin")
.use(ESLintPlugin, [{ extensions: ["js"] }]);
},
},
};
});

View File

@ -1,6 +1,6 @@
import { urlPathAudio as settings } from '@/settings';
import { REST, RESTError } from './rest';
import {urlPathAudio} from "@/settings";
import { urlPathAudio } from '@/settings';
export default class extends REST {
static get settings() {
@ -12,15 +12,17 @@ export default class extends REST {
const sseUriParams = new URLSearchParams({
cf_connect: JSON.stringify({
subs: {
"station:it-radio": { recover: true },
'station:it-radio': { recover: true },
},
}),
});
this.connection = new EventSource(sseBaseUri + "?" + sseUriParams.toString());
this.connection = new EventSource(
sseBaseUri + '?' + sseUriParams.toString(),
);
}
removePlay() {
this.connection.close()
this.connection.close();
}
songs() {
this.connection.onmessage = (e) => {
@ -48,17 +50,18 @@ export default class extends REST {
// handleSseData(jsonData.pub);
// }
};
}
onHandler(event) {
this.connection.onmessage = event
this.connection.onmessage = event;
}
static getPlayList(station, params) {
// return this._get(`station/${station}/playlists`, params, {}).then((data) => {
return this._get(`radio.mp3`, params, {}).then((data) => {
return this._get(`radio.mp3`, params, {})
.then((data) => {
return data;
}).catch((error) => {
})
.catch((error) => {
throw new RESTError(error, 'Ошибка при получении плейлистов');
});
}