Remove Vue ESLint plugin for Vite compatibility

The Vue ESLint plugin is not compatible with Vite and isn't provided in
Vite's default template. By removing it, the codebase progresses toward
the migration to Vue 3.0 and Vite (#230).

Changes:

- Directly execute `eslint` in the `npm run lint:eslint` command.
- Fix previously undetected linting issues that weren't covered by Vue
  CLI's default configuration.
- Updated various configuration files, reflecting the removal and lint
  fixes.
- Remove unused `eslint-plugin-import` dependency that is already
  imported by `@vue/eslint-config-airbnb-with-typescript`.

In `.eslintrc.cjs`:

- Add `es2022` as environment in to simplify setting parser options and
  align with Vite starter configuration.
- Remove useless tests override.
- Move tests override in root `.eslintrc.cjs` to `tests/` for clarity,
  better organization, scalability and separation of concerns.
This commit is contained in:
undergroundwires
2023-08-23 09:47:44 +02:00
parent 5f11c8d98f
commit 6e40edd3f8
13 changed files with 166 additions and 745 deletions

View File

@@ -1 +1,2 @@
dist/
dist/
dist_electron/

View File

@@ -6,6 +6,7 @@ module.exports = {
root: true,
env: {
node: true,
es2022: true, // add globals and sets parserOptions.ecmaVersion to 2022
},
extends: [
// Vue specific rules, eslint-plugin-vue
@@ -20,36 +21,12 @@ module.exports = {
// Added by Vue CLI
'@vue/typescript/recommended',
],
parserOptions: {
ecmaVersion: 2022, // So it allows top-level awaits
/*
Having 'latest' leads to:
```
Parsing error: ecmaVersion must be a number. Received value of type string instead
```
For .js files in the project
*/
},
rules: {
...getOwnRules(),
...getTurnedOffBrokenRules(),
...getOpinionatedRuleOverrides(),
...getTodoRules(),
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
},
{
files: ['**/tests/**/*.{j,t}s?(x)'],
rules: {
'no-console': 'off',
},
},
],
};
function getOwnRules() {

View File

@@ -1,5 +1,5 @@
import { defineConfig } from 'cypress';
import setupPlugins from './tests/e2e/plugins/index.js';
import setupPlugins from './tests/e2e/plugins/index';
export default defineConfig({
fixturesFolder: 'tests/e2e/fixtures',

View File

@@ -61,7 +61,7 @@ async function updateDesktopIcons(sourceImage, electronIconsDir) {
await ensureFolderExists(electronIconsDir);
const temporaryDir = await mkdtemp('icon-');
const temporaryPngFile = join(temporaryDir, 'icon.png');
console.log(`Converting from SVG (${sourceImage}) to PNG: ${temporaryPngFile}`); // required by icon-builder
console.log(`Converting from SVG (${sourceImage}) to PNG: ${temporaryPngFile}`) // required by icon-builder
await runCommand(
'npx',
'svgexport',

849
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,7 @@
"create-icons": "node img/logo-update.mjs",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"lint:eslint": "vue-cli-service lint --no-fix --mode production",
"lint:eslint": "eslint .",
"lint:md": "markdownlint **/*.md --ignore node_modules",
"lint:md:consistency": "remark . --frail --use remark-preset-lint-consistent",
"lint:md:relative-urls": "remark . --frail --use remark-validate-links",
@@ -54,7 +54,6 @@
"@vitejs/plugin-vue2": "^2.2.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-e2e-cypress": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-typescript": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/eslint-config-airbnb-with-typescript": "^7.0.0",
@@ -68,7 +67,6 @@
"electron-log": "^4.4.8",
"electron-updater": "^6.1.4",
"eslint": "^8.46.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-vue": "^9.6.0",
"eslint-plugin-vuejs-accessibility": "^1.2.0",
"icon-gen": "^3.0.1",

View File

@@ -1,11 +1,10 @@
const { rules: baseStyleRules } = require('eslint-config-airbnb-base/rules/style');
require('@rushstack/eslint-patch/modern-module-resolution');
require('@rushstack/eslint-patch/modern-module-resolution.js');
module.exports = {
env: {
node: true,
},
rules: {
"import/extensions": ["error", "always"],
'import/extensions': ['error', 'always'],
},
};

View File

@@ -56,7 +56,7 @@ async function captureTitlesOnLinux(processId) {
const titles = await Promise.all(windowIds.map(async (windowId) => {
const { stdout: titleOutput, error: titleError } = await runCommand(
`xprop -id ${windowId} | grep "WM_NAME(STRING)" | cut -d '=' -f 2 | sed 's/^[[:space:]]*"\\(.*\\)"[[:space:]]*$/\\1/'`
`xprop -id ${windowId} | grep "WM_NAME(STRING)" | cut -d '=' -f 2 | sed 's/^[[:space:]]*"\\(.*\\)"[[:space:]]*$/\\1/'`,
);
if (titleError || !titleOutput) {
return undefined;

View File

@@ -3,5 +3,5 @@ import { join } from 'path';
export const DESKTOP_BUILD_COMMAND = 'npm run electron:build -- -p never';
export const PROJECT_DIR = process.cwd();
export const DESKTOP_DIST_PATH = join(PROJECT_DIR, 'dist_electron');
export const APP_EXECUTION_DURATION_IN_SECONDS = 60; // Long enough so CI runners have time to bootstrap it
export const APP_EXECUTION_DURATION_IN_SECONDS = 60; // Long enough for CI runners
export const SCREENSHOT_PATH = join(PROJECT_DIR, 'screenshot.png');

View File

@@ -1,5 +1,4 @@
import { exec } from 'child_process';
import { LOG_LEVELS, log } from './log.js';
import { indentText } from './text.js';
const TIMEOUT_IN_SECONDS = 180;

5
tests/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,5 @@
module.exports = {
rules: {
'no-console': 'off',
},
};

View File

@@ -31,11 +31,8 @@
}
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
"**/*.ts",
"**/*.vue"
],
"exclude": [
"node_modules"

View File

@@ -16,6 +16,6 @@ export default defineConfig({
},
setupFiles: [
'tests/bootstrap/setup.ts',
]
}
],
},
});