Only allow jsx in jsx/tsx files

This commit is contained in:
Bill Thornton 2022-09-29 12:50:25 -04:00
parent 459fc0bbe7
commit 23eede4d2f
4 changed files with 52 additions and 49 deletions

View File

@ -64,7 +64,9 @@ module.exports = {
'space-before-blocks': ['error'], 'space-before-blocks': ['error'],
'space-infix-ops': 'error', 'space-infix-ops': 'error',
'yoda': 'error', 'yoda': 'error',
'no-sequences': ['error', { 'allowInParentheses': false }] 'no-sequences': ['error', { 'allowInParentheses': false }],
'react/jsx-filename-extension': ['error', { 'extensions': ['.jsx', '.tsx'] }]
}, },
settings: { settings: {
react: { react: {
@ -180,6 +182,7 @@ module.exports = {
{ {
files: [ files: [
'./src/**/*.js', './src/**/*.js',
'./src/**/*.jsx',
'./src/**/*.ts' './src/**/*.ts'
], ],
parser: '@babel/eslint-parser', parser: '@babel/eslint-parser',

View File

@ -6,44 +6,44 @@ import 'intersection-observer';
import 'classlist.js'; import 'classlist.js';
import 'whatwg-fetch'; import 'whatwg-fetch';
import 'resize-observer-polyfill'; import 'resize-observer-polyfill';
import '../assets/css/site.scss'; import './assets/css/site.scss';
import React from 'react'; import React from 'react';
import * as ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import { Events } from 'jellyfin-apiclient'; import { Events } from 'jellyfin-apiclient';
import ServerConnections from '../components/ServerConnections'; import ServerConnections from './components/ServerConnections';
import globalize from './globalize'; import globalize from './scripts/globalize';
import browser from './browser'; import browser from './scripts/browser';
import keyboardNavigation from './keyboardNavigation'; import keyboardNavigation from './scripts/keyboardNavigation';
import './mouseManager'; import './scripts/mouseManager';
import autoFocuser from '../components/autoFocuser'; import autoFocuser from './components/autoFocuser';
import { appHost } from '../components/apphost'; import { appHost } from './components/apphost';
import { getPlugins } from './settings/webSettings'; import { getPlugins } from './scripts/settings/webSettings';
import { pluginManager } from '../components/pluginManager'; import { pluginManager } from './components/pluginManager';
import packageManager from '../components/packageManager'; import packageManager from './components/packageManager';
import { appRouter, history } from '../components/appRouter'; import { appRouter, history } from './components/appRouter';
import '../elements/emby-button/emby-button'; import './elements/emby-button/emby-button';
import './autoThemes'; import './scripts/autoThemes';
import './libraryMenu'; import './scripts/libraryMenu';
import './routes'; import './scripts/routes';
import '../components/themeMediaPlayer'; import './components/themeMediaPlayer';
import './autoBackdrops'; import './scripts/autoBackdrops';
import { pageClassOn, serverAddress } from '../utils/dashboard'; import { pageClassOn, serverAddress } from './utils/dashboard';
import './screensavermanager'; import './scripts/screensavermanager';
import './serverNotifications'; import './scripts/serverNotifications';
import '../components/playback/playerSelectionMenu'; import './components/playback/playerSelectionMenu';
import '../legacy/domParserTextHtml'; import './legacy/domParserTextHtml';
import '../legacy/focusPreventScroll'; import './legacy/focusPreventScroll';
import '../legacy/htmlMediaElement'; import './legacy/htmlMediaElement';
import '../legacy/vendorStyles'; import './legacy/vendorStyles';
import SyncPlay from '../components/syncPlay/core'; import SyncPlay from './components/syncPlay/core';
import { playbackManager } from '../components/playback/playbackmanager'; import { playbackManager } from './components/playback/playbackmanager';
import SyncPlayNoActivePlayer from '../components/syncPlay/ui/players/NoActivePlayer'; import SyncPlayNoActivePlayer from './components/syncPlay/ui/players/NoActivePlayer';
import SyncPlayHtmlVideoPlayer from '../components/syncPlay/ui/players/HtmlVideoPlayer'; import SyncPlayHtmlVideoPlayer from './components/syncPlay/ui/players/HtmlVideoPlayer';
import SyncPlayHtmlAudioPlayer from '../components/syncPlay/ui/players/HtmlAudioPlayer'; import SyncPlayHtmlAudioPlayer from './components/syncPlay/ui/players/HtmlAudioPlayer';
import { currentSettings } from './settings/userSettings'; import { currentSettings } from './scripts/settings/userSettings';
import taskButton from './taskbutton'; import taskButton from './scripts/taskbutton';
import { HistoryRouter } from '../components/HistoryRouter.tsx'; import { HistoryRouter } from './components/HistoryRouter.tsx';
import AppRoutes from '../routes/index.tsx'; import AppRoutes from './routes/index.tsx';
function loadCoreDictionary() { function loadCoreDictionary() {
const languages = ['af', 'ar', 'be-by', 'bg-bg', 'bn_bd', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en-gb', 'en-us', 'eo', 'es', 'es-419', 'es-ar', 'es_do', 'es-mx', 'et', 'fa', 'fi', 'fil', 'fr', 'fr-ca', 'gl', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'ja', 'kk', 'ko', 'lt-lt', 'lv', 'mr', 'ms', 'nb', 'nl', 'nn', 'pl', 'pr', 'pt', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sq', 'sv', 'ta', 'th', 'tr', 'uk', 'ur_pk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw']; const languages = ['af', 'ar', 'be-by', 'bg-bg', 'bn_bd', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en-gb', 'en-us', 'eo', 'es', 'es-419', 'es-ar', 'es_do', 'es-mx', 'et', 'fa', 'fi', 'fil', 'fr', 'fr-ca', 'gl', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'ja', 'kk', 'ko', 'lt-lt', 'lv', 'mr', 'ms', 'nb', 'nl', 'nn', 'pl', 'pr', 'pt', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sq', 'sv', 'ta', 'th', 'tr', 'uk', 'ur_pk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
@ -94,13 +94,13 @@ function onGlobalizeInit() {
if (browser.tv && !browser.android) { if (browser.tv && !browser.android) {
console.debug('using system fonts with explicit sizes'); console.debug('using system fonts with explicit sizes');
import('../assets/css/fonts.sized.scss'); import('./assets/css/fonts.sized.scss');
} else { } else {
console.debug('using default fonts'); console.debug('using default fonts');
import('../assets/css/fonts.scss'); import('./assets/css/fonts.scss');
} }
import('../assets/css/librarybrowser.scss'); import('./assets/css/librarybrowser.scss');
loadPlugins().then(function () { loadPlugins().then(function () {
initSyncPlay(); initSyncPlay();
@ -164,7 +164,7 @@ async function onAppReady() {
console.debug('onAppReady: loading dependencies'); console.debug('onAppReady: loading dependencies');
if (browser.iOS) { if (browser.iOS) {
import('../assets/css/ios.scss'); import('./assets/css/ios.scss');
} }
Events.on(appHost, 'resume', () => { Events.on(appHost, 'resume', () => {
@ -181,29 +181,29 @@ async function onAppReady() {
); );
if (!browser.tv && !browser.xboxOne && !browser.ps4) { if (!browser.tv && !browser.xboxOne && !browser.ps4) {
import('../components/nowPlayingBar/nowPlayingBar'); import('./components/nowPlayingBar/nowPlayingBar');
} }
if (appHost.supports('remotecontrol')) { if (appHost.supports('remotecontrol')) {
import('../components/playback/playerSelectionMenu'); import('./components/playback/playerSelectionMenu');
import('../components/playback/remotecontrolautoplay'); import('./components/playback/remotecontrolautoplay');
} }
if (!appHost.supports('physicalvolumecontrol') || browser.touch) { if (!appHost.supports('physicalvolumecontrol') || browser.touch) {
import('../components/playback/volumeosd'); import('./components/playback/volumeosd');
} }
/* eslint-disable-next-line compat/compat */ /* eslint-disable-next-line compat/compat */
if (navigator.mediaSession || window.NativeShell) { if (navigator.mediaSession || window.NativeShell) {
import('../components/playback/mediasession'); import('./components/playback/mediasession');
} }
if (!browser.tv && !browser.xboxOne) { if (!browser.tv && !browser.xboxOne) {
import('../components/playback/playbackorientation'); import('./components/playback/playbackorientation');
registerServiceWorker(); registerServiceWorker();
if (window.Notification) { if (window.Notification) {
import('../components/notifications/notifications'); import('./components/notifications/notifications');
} }
} }

View File

@ -5,7 +5,7 @@ module.exports = merge(common, {
// In order for live reload to work we must use "web" as the target not "browserslist" // In order for live reload to work we must use "web" as the target not "browserslist"
target: process.env.WEBPACK_SERVE ? 'web' : 'browserslist', target: process.env.WEBPACK_SERVE ? 'web' : 'browserslist',
mode: 'development', mode: 'development',
entry: { 'main.jellyfin': './scripts/site.js' }, entry: { 'main.jellyfin': './index.jsx' },
devtool: 'eval-cheap-module-source-map', devtool: 'eval-cheap-module-source-map',
module: { module: {
rules: [ rules: [

View File

@ -5,7 +5,7 @@ const WorkboxPlugin = require('workbox-webpack-plugin');
module.exports = merge(common, { module.exports = merge(common, {
mode: 'production', mode: 'production',
entry: { 'main.jellyfin': './scripts/site.js' }, entry: { 'main.jellyfin': './index.jsx' },
plugins: [ plugins: [
new WorkboxPlugin.InjectManifest({ new WorkboxPlugin.InjectManifest({
swSrc: path.resolve(__dirname, 'src/serviceworker.js'), swSrc: path.resolve(__dirname, 'src/serviceworker.js'),