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

Updates from electron-react-boilerplate #71

Merged
merged 9 commits into from
Mar 14, 2023
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 .erb/scripts/clean.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import rimraf from 'rimraf';
import fs from 'fs';
import webpackPaths from '../configs/webpack.paths';

const foldersToRemove = [
Expand All @@ -8,5 +9,5 @@ const foldersToRemove = [
];

foldersToRemove.forEach((folder) => {
rimraf.sync(folder);
if (fs.existsSync(folder)) rimraf.sync(folder);
});
7 changes: 5 additions & 2 deletions .erb/scripts/delete-source-maps.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import fs from 'fs';
import path from 'path';
import rimraf from 'rimraf';
import webpackPaths from '../configs/webpack.paths';

export default function deleteSourceMaps() {
rimraf.sync(path.join(webpackPaths.distMainPath, '*.js.map'));
rimraf.sync(path.join(webpackPaths.distRendererPath, '*.js.map'));
if (fs.existsSync(webpackPaths.distMainPath))
rimraf.sync(path.join(webpackPaths.distMainPath, '*.js.map'));
if (fs.existsSync(webpackPaths.distRendererPath))
rimraf.sync(path.join(webpackPaths.distRendererPath, '*.js.map'));
}
19 changes: 16 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@ module.exports = {
rules: {
// #region ERB rules

'import/extensions': 'off',
// A temporary hack related to IDE not resolving correct package.json
'import/no-extraneous-dependencies': 'off',
'import/no-import-module-exports': 'off',
'import/no-unresolved': 'error',
// Since React 17 and typescript 4.1 you can safely disable the rule
'react/jsx-filename-extension': 'off',
tjcouch-sil marked this conversation as resolved.
Show resolved Hide resolved
'react/react-in-jsx-scope': 'off',

// #endregion

// #region Our rules

// This is already a Typescript rule, so we don't need it to be reported twice
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'comma-dangle': ['error', 'always-multiline'],
indent: 'off',
'jsx-a11y/label-has-associated-control': [
Expand All @@ -26,20 +34,25 @@ module.exports = {
// Should use our logger anytime you want logs that persist. Otherwise use console only in testing
'no-console': 'warn',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-use-before-define': 'off',
tjcouch-sil marked this conversation as resolved.
Show resolved Hide resolved
'prettier/prettier': ['warn', { tabWidth: 2, trailingComma: 'all' }],
'react/jsx-indent-props': ['warn', 2],
'react/jsx-props-no-spreading': ['error', { custom: 'ignore' }],
'react/require-default-props': 'off',

// #endregion
},
globals: {
tjcouch-sil marked this conversation as resolved.
Show resolved Hide resolved
globalThis: 'readonly',
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
plugins: ['@typescript-eslint'],
settings: {
'import/resolver': {
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
npm install
npm run build

- name: Install DMG license
if: ${{ matrix.os == 'macos-latest' }}
run: npm install dmg-license

- name: dotnet build - MacOS and Windows
if: ${{ matrix.os == 'macos-latest' }}
run: |
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ jobs:
cache: npm

- name: npm install
run: |
npm install
run: npm install

- name: Install DMG license
if: ${{ matrix.os == 'macos-latest' }}
run: npm install dmg-license

- name: dotnet build
run: npm run build:data-release
Expand Down
2 changes: 2 additions & 0 deletions assets/assets.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
type Styles = Record<string, string>;

declare module '*.svg' {
import React = require('react');

export const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;

const content: string;
Expand Down
3 changes: 1 addition & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line jest/no-jest-import
import type { Config } from 'jest';
import { pathsToModuleNameMapper } from 'ts-jest';
import { compilerOptions } from './tsconfig.json';
Expand All @@ -18,7 +17,7 @@ const config: Config = {
testEnvironmentOptions: {
url: 'http://localhost/',
},
testPathIgnorePatterns: ['release/app/dist'],
testPathIgnorePatterns: ['release/app/dist', '.erb/dll'],
tjcouch-sil marked this conversation as resolved.
Show resolved Hide resolved
transform: {
'\\.(ts|tsx|js|jsx)$': 'ts-jest',
},
Expand Down
Loading