пофиксил ошибку 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: { parserOptions: {
parser: '@babel/eslint-parser', parser: '@babel/eslint-parser',
ecmaVersion: 2021, // Allows for the parsing of modern ECMAScript features 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: { env: {
browser: true, browser: true,
'vue/setup-compiler-macros': true 'vue/setup-compiler-macros': true,
}, },
// Rules order is important, please avoid shuffling them // 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) // 'plugin:vue/vue3-recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
// 'standard' // 'standard'
], ],
plugins: [ plugins: [
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
// required to lint *.vue files // required to lint *.vue files
'vue', 'vue',
], ],
globals: { globals: {
@ -50,12 +50,11 @@ module.exports = {
__QUASAR_SSR_PWA__: 'readonly', __QUASAR_SSR_PWA__: 'readonly',
process: 'readonly', process: 'readonly',
Capacitor: 'readonly', Capacitor: 'readonly',
chrome: 'readonly' chrome: 'readonly',
}, },
// add your custom rules here // add your custom rules here
rules: { rules: {
// allow async-await // allow async-await
'generator-star-spacing': 'off', 'generator-star-spacing': 'off',
// allow paren-less arrow functions // allow paren-less arrow functions
@ -82,6 +81,6 @@ module.exports = {
'vue/no-v-for-template-key': 'warn', 'vue/no-v-for-template-key': 'warn',
'vue/multi-word-component-names': 'off', 'vue/multi-word-component-names': 'off',
// allow debugger during development only // 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 */ /* eslint-disable */
module.exports = api => { module.exports = (api) => {
return { return {
presets: [ presets: [
[ [
'@quasar/babel-preset-app', '@quasar/babel-preset-app',
api.caller(caller => caller && caller.target === 'node') api.caller((caller) => caller && caller.target === 'node')
? { targets: { node: 'current' } } ? { targets: { node: 'current' } }
: {} : {},
] ],
] ],
} };
} };

View File

@ -50,6 +50,7 @@
"postcss-nested": "^6.0.1", "postcss-nested": "^6.0.1",
"postcss-preset-env": "^9.2.0", "postcss-preset-env": "^9.2.0",
"postcss-simple-vars": "^7.0.1", "postcss-simple-vars": "^7.0.1",
"prettier": "^3.3.2",
"sass-loader": "^13.3.2", "sass-loader": "^13.3.2",
"vue-loader": "^17.3.0" "vue-loader": "^17.3.0"
}, },
@ -12808,6 +12809,21 @@
"node": ">= 0.8.0" "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": { "node_modules/pretty-error": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz",
@ -24507,6 +24523,12 @@
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true "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": { "pretty-error": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", "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-nested": "^6.0.1",
"postcss-preset-env": "^9.2.0", "postcss-preset-env": "^9.2.0",
"postcss-simple-vars": "^7.0.1", "postcss-simple-vars": "^7.0.1",
"prettier": "^3.3.2",
"sass-loader": "^13.3.2", "sass-loader": "^13.3.2",
"vue-loader": "^17.3.0" "vue-loader": "^17.3.0"
}, },

View File

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

View File

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