Skip to content
Draft
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
24 changes: 24 additions & 0 deletions .github/workflows/ui-lint-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run UI linter and formatter

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Node.js 22.x (LTS)
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install dependencies
run: npm install
- name: Run UI linter
run: npm run lint
- name: Run UI formatter
run: npm run format
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage
web-ui
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 88,
"endOfLine": "auto",
"bracketSameLine": true
}
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Added
- Fixed map background buttons
- Added ``enable_filter`` prop for ``k-select`` component to enable an input box which content will filter options.
- MapBox Settings will now be stored within localStorage
- Added ESLint and Prettier for linting and formatting.
- Added a Github workflow for linting and formatting.

Fixed
=====
Expand Down
38 changes: 38 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const {
defineConfig,
globalIgnores
} = require("eslint/config");

const globals = require("globals");
const js = require("@eslint/js");

const {
FlatCompat,
} = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
//allConfig: js.configs.all
});

module.exports = defineConfig([
globalIgnores(["web-ui/", "coverage/"]),
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {},
},
extends: compat.extends("eslint:recommended", "plugin:vue/recommended", "prettier"),
rules: {
"vue/attributes-order": "off",
"vue/component-definition-name-casing": "off"
},
settings: {}
}
]);
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"preview": "vite preview",
"test": "vitest",
"test-run": "vitest run",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"lint": "eslint",
"format": "prettier",
"validate": "npm run lint && npm run format"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.5.2",
Expand All @@ -27,29 +30,38 @@
"d3": "^7.9.0",
"glob": "^7.2.0",
"jsdocgen": "^0.2.4",
"mapbox-gl": "^2.15.0",
"pinia": "^3.0.2",
"string-width-cjs": "^5.1.1",
"tiny-emitter": "^2.1.0",
"typeit": "^8.2.0",
"v-hotkey3": "^0.1.4",
"vue": "^3.1.0",
"vue-docgen-api": "^4.43.2",
"write-file": "^1.0.0",
"mapbox-gl": "^2.15.0"
"write-file": "^1.0.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.37.0",
"@pinia/testing": "^1.0.1",
"@vitejs/plugin-vue": "^5.2.1",
"@vitest/coverage-v8": "^3.0.7",
"@vue/compiler-sfc": "^3.1.0",
"@vue/test-utils": "^2.4.6",
"cross-env": "^7.0.3",
"eslint": "^9.37.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-vue": "^10.5.0",
"globals": "^16.4.0",
"happy-dom": "^17.1.9",
"jquery": "^3.6.0",
"jquery-slider": "^0.0.1",
"jsdom": "^26.0.0",
"prettier": "^3.6.2",
"sass": "^1.85.1",
"vite": "^6.0.7",
"vite-plugin-eslint": "^1.8.1",
"vitest": "^3.0.7",
"vue3-sfc-loader": "^0.9.5",
"yargs": "^17.3.1"
Expand Down
6 changes: 4 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { defineConfig } from 'vite';
import { configDefaults } from 'vitest/config';
import vue from '@vitejs/plugin-vue';
import eslint from 'vite-plugin-eslint';
import { resolve } from 'path';

export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
if (mode === 'preprod') {
return {
plugins: [vue()],
plugins: [vue(), /**eslint()**/],
build: {
outDir: './web-ui/',
assetsDir: './dist/',
sourcemap: true,
minify: false
},

resolve: {
alias: {
'@': resolve(__dirname, './src')
Expand All @@ -34,7 +36,7 @@ export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
}
} else {
return {
plugins: [vue()],
plugins: [vue(), /**eslint()**/],
build: {
outDir: './web-ui/',
assetsDir: './dist/',
Expand Down
Loading