Skip to content

Commit

Permalink
Various eslint and ts fixes, pr status badge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
milespetrov committed Jan 8, 2025
1 parent ca82177 commit e359416
Show file tree
Hide file tree
Showing 100 changed files with 378 additions and 345 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/demo-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
with:
name: 'tsbadge'
icon: typescript
label: 'TS Errors'
label: 'Errors'
status: ${{ steps.pr-checks.outputs.ts-errors }}
color: blue
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -126,7 +126,7 @@ jobs:
with:
name: 'lintbadge'
icon: codecov
label: 'Lint'
label: 'Status'
status: 'Errors: ${{ steps.pr-checks.outputs.lint-errors }}, Warnings: ${{ steps.pr-checks.outputs.lint-warnings }}'
color: purple
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/demo-pr-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
Catalogue: https://${{github.event.pull_request.head.repo.owner.login}}.github.io/ramp4-pcar4/${{github.head_ref}}/demos/index-all.html
Samples: https://${{github.event.pull_request.head.repo.owner.login}}.github.io/ramp4-pcar4/${{github.head_ref}}/demos/index-samples.html
![](https://byob.yarr.is/ramp4-pcar4/ramp4-pcar4/tsbadge-${{github.head_ref}}) ![](https://byob.yarr.is/ramp4-pcar4/ramp4-pcar4/lintbadge-${{github.head_ref}})
![](https://byob.yarr.is/ramp4-pcar4/ramp4-pcar4/tsbadge-${{ github.event.pull_request.head.repo.owner.login }}-${{ github.head_ref }}) ![](https://byob.yarr.is/ramp4-pcar4/ramp4-pcar4/lintbadge-${{ github.event.pull_request.head.repo.owner.login }}-${{ github.head_ref }})
10 changes: 5 additions & 5 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
pull_request:
pull_request_target:
types: [opened, synchronize]

jobs:
Expand Down Expand Up @@ -37,9 +37,9 @@ jobs:
if: always()
uses: RubbaBoy/BYOB@v1.3.0
with:
name: 'tsbadge-${{github.head_ref}}'
name: 'tsbadge-${{ github.event.pull_request.head.repo.owner.login }}-${{ github.head_ref }}'
icon: typescript
label: 'TS Errors'
label: 'Errors (PR)'
status: ${{ steps.pr-checks.outputs.ts-errors }}
color: blue
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -48,9 +48,9 @@ jobs:
if: always()
uses: RubbaBoy/BYOB@v1.3.0
with:
name: 'lintbadge-${{github.head_ref}}'
name: 'lintbadge-${{ github.event.pull_request.head.repo.owner.login }}-${{ github.head_ref }}'
icon: codecov
label: 'Lint'
label: 'Status (PR)'
status: 'Errors: ${{ steps.pr-checks.outputs.lint-errors }}, Warnings: ${{ steps.pr-checks.outputs.lint-warnings }}'
color: purple
github_token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 7 additions & 3 deletions demos/enhanced-scripts/000-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ addLegendLang(legendConfig, langKey)
*/

const runPreTest = (config, options, utils) => {
// All available params:
// const runPreTest = (config, options, utils) => {
const runPreTest = (config, options) => {
// Do any config setup & options setup here, if any

return { config, options };
};

const runPostTest = (instance, utils) => {
// Do any test steps on the instantiated instnace, if any
// All available params:
// const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Do any test steps on the instantiated instance, if any
};

export { runPreTest, runPostTest };
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/001-happy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Not used in this test
};

Expand Down
4 changes: 2 additions & 2 deletions demos/enhanced-scripts/002-simple-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Test 02: An empty map.
- Just adds legend text to make it look not broken
*/

const runPreTest = (config, options, utils) => {
const runPreTest = (config, options) => {
config.configs.en.fixtures.legend.root.children.push({
infoType: 'text',
content: 'I start with no layers'
Expand All @@ -17,7 +17,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Do any test steps on the instantiated instnace, if any
};

Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/003-simple-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Not used in this test
};

Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/004-simple-mil.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Not used in this test
};

Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/005-simple-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Not used in this test
};

Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/006-simple-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = instance => {
instance.$element.component('Tasty-Template', {
props: ['identifyData'],
template: `
Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/007-main-classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = instance => {
// template with our friend Rick.
instance.$element.component('WFSLayer-Custom', {
props: ['identifyData'],
Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/008-projection-party.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Not used in this test
};

Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/009-custom-panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = instance => {
instance.fixture.isLoaded('basemap').then(() => {
const bm = instance.fixture.get('basemap');
bm.persist = false;
Expand Down
2 changes: 1 addition & 1 deletion demos/enhanced-scripts/010-identify-priority.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Nothing for this test
};

Expand Down
4 changes: 2 additions & 2 deletions demos/qa-scripts/001-simple-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Test 01: An empty map.
QA TEST SCRIPT. Don't modify without chatting with QA first.
*/

const runPreTest = (config, options, utils) => {
const runPreTest = (config, options) => {
config.configs.en.fixtures.legend.root.children.push({
infoType: 'text',
content: 'I start with no layers'
Expand All @@ -19,7 +19,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Do any test steps on the instantiated instnace, if any
};

Expand Down
2 changes: 1 addition & 1 deletion demos/qa-scripts/002-custom-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ const runPreTest = (config, options, utils) => {
return { config, options };
};

const runPostTest = (instance, utils) => {
const runPostTest = () => {
// Not used in this test
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { h, markRaw, resolveComponent } from 'vue';
export class DiligordFixture {
added() {
// `this.id` and `this.$iApi` and `this.$vApp` are automatically made available on this object
this.id;
this.$iApi;
this.$vApp;

// Diligord Fixture creates a simple panel with a single screen with two header controls (pin and close),
// and increment button and an input field (bound to the panel title) in the content slot
Expand Down
4 changes: 2 additions & 2 deletions demos/starter-scripts/sample-fixtures/funtimes/screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<panel-screen :panel="panel">
<template #header>
{{
//@ts-ignore
//@ts-expect-error
$iApi.$i18n.t('funtimes')
}}
</template>

<template #content>
<p>
{{
//@ts-ignore
//@ts-expect-error
$iApi.$i18n.t('funtimes.info')
}}
</p>
Expand Down
9 changes: 8 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default [
},
{
name: 'app/files-to-ignore',
ignores: ['**/dist/**']
ignores: ['**/dist/**', '**/tests/**', '**/*.d.ts']
},
{
rules: {
Expand All @@ -28,5 +28,12 @@ export default [
'cypress/support/**/*.{js,ts,jsx,tsx}'
]
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-this-alias': 'off',
'vue/multi-word-component-names': 'off'
}
},
skipFormatting
];
4 changes: 0 additions & 4 deletions postcss.config.cjs

This file was deleted.

9 changes: 9 additions & 0 deletions postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-env node */
import postcssImport from 'postcss-import';
import postcssNested from 'postcss-nested';
import tailwindcss from 'tailwindcss';
import autoprefixer from 'autoprefixer';

export default {
plugins: [postcssImport, postcssNested, tailwindcss, autoprefixer]
};
2 changes: 1 addition & 1 deletion scripts/vite-plugin-i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type { Plugin } from 'vite';
// @ts-ignore
// @ts-expect-error
import { dsvFormat } from 'd3-dsv';

export default function vueI18nPlugin(): Plugin {
Expand Down
18 changes: 9 additions & 9 deletions scripts/vite-plugin-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export default (): Plugin => {

const [major, minor, patch] = pkg.version.split('.');

config.define
? (config.define.__RAMP_VERSION__ = {
major,
minor,
patch,
timestamp,
hash
})
: null;
if (config.define) {
config.define.__RAMP_VERSION__ = {
major,
minor,
patch,
timestamp,
hash
};
}
}
};
};
10 changes: 5 additions & 5 deletions src/api/config-upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,8 @@ function layerCommonPropertiesUpgrader(r2layer: any) {
* @param r2controls controls array from RAMP2 config
* @param allowedControls controls supported by RAMP4 config
*/
function controlsUpgrader(r2controls: String[], allowedControls: String[]) {
const r4controls: String[] = [];
function controlsUpgrader(r2controls: string[], allowedControls: string[]) {
const r4controls: string[] = [];
r2controls.forEach((control: any) => {
if (allowedControls.includes('identify') && control === 'query') {
r4controls.push('identify');
Expand Down Expand Up @@ -1016,7 +1016,7 @@ function servicesUpgrader(r2Services: any, r4c: any): void {
}

// If any of these properties get implemented/used in the future, remove them from the warning list and map them appropriately.
const unused: String[] = [
const unused: string[] = [
'corsEverywhere',
'exportMapUrl',
'geometryUrl',
Expand Down Expand Up @@ -1078,7 +1078,7 @@ function uiUpgrader(r2ui: any, r4c: any): void {
}

if (r2ui.legend) {
const headerControls: String[] = ['groupToggle', 'visibilityToggle'];
const headerControls: string[] = ['groupToggle', 'visibilityToggle'];
if (r2ui.legend.reorderable) {
headerControls.push('layerReorder');
}
Expand Down Expand Up @@ -1224,7 +1224,7 @@ function uiUpgrader(r2ui: any, r4c: any): void {
}

// If any of these properties get implemented/used in the future, remove them from the warning list and map them appropriately.
const unused: String[] = [
const unused: string[] = [
'fullscreen',
'theme',
'logoUrl',
Expand Down
12 changes: 6 additions & 6 deletions src/api/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ enum DefEH {
class EventHandler {
eventName: string;
handlerName: string;
handlerFunc: Function;
handlerFunc: () => void;

constructor(eName: string, hName: string, handler: Function) {
constructor(eName: string, hName: string, handler: () => void) {
this.eventName = eName;
this.handlerName = hName;
this.handlerFunc = handler;
Expand Down Expand Up @@ -483,7 +483,7 @@ export class EventAPI extends APIScope {
* @returns {string} the handler name
* @memberof EventAPI
*/
on(event: string, callback: Function, handlerName = ''): string {
on(event: string, callback: (...args: any[]) => void, handlerName = ''): string {
// check if name already registered
if (this.findHandler(handlerName)) {
// TODO decide if we are replacing, erroring, do nothing + console warn?
Expand Down Expand Up @@ -564,14 +564,14 @@ export class EventAPI extends APIScope {
* @returns {string} the handler name
* @memberof EventAPI
*/
once(event: string, callback: Function, handlerName = ''): string {
once(event: string, callback: (args: any[]) => void, handlerName = ''): string {
// need to do this here and upfront, so we have the name for the unregistration.
// otherwise we would let the .on() call do its naming thing
if (!handlerName) {
handlerName = this.handlerNamer(event);
}

const secretCallback = (...args: any[]) => {
const secretCallback = (...args: [any]) => {
// run the original function. unregister our one-time handler
callback(...args);
this.off(handlerName);
Expand Down Expand Up @@ -627,7 +627,7 @@ export class EventAPI extends APIScope {
* @private
*/
private defaultHandlerFactory(handlerName: string): string {
let zeHandler: Function;
let zeHandler: (payload?: any) => void;
switch (handlerName) {
case DefEH.CONFIG_CHANGE_UPDATES_MAP_ATTRIBS:
// update any basemap attribution in the map caption when the config changes (likely language switch)
Expand Down
Loading

0 comments on commit e359416

Please sign in to comment.