Skip to content

Commit

Permalink
Upgrade ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJaredWilcurt committed Sep 29, 2024
1 parent fe5e220 commit 5b72647
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 80 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

23 changes: 0 additions & 23 deletions .eslintrc.js

This file was deleted.

56 changes: 46 additions & 10 deletions _components/base-card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,53 @@
class="card"
>
<div class="card-header">
<a v-if="tool.url" :href="tool.url" target="_blank" rel="noopener noreferrer">{{ tool.title }}</a>
<a
v-if="tool.url"
:href="tool.url"
target="_blank"
rel="noopener noreferrer"
>{{ tool.title }}</a>
<span v-else>{{ tool.title }}</span>
<span class="expand" @click="$emit('expandcard', tool)">
<span
class="expand"
@click="$emit('expandcard', tool)"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
role="img"
aria-label="Expand this card, hiding the rest. Updates URL for linking to this tool."
>
<path d="M16 0H9.5L12 2.5l-3 3L10.5 7l3-3L16 6.5zM16 16V9.5L13.5 12l-3-3L9 10.5l3 3L9.5 16zM0 16h6.5L4 13.5l3-3L5.5 9l-3 3L0 9.5zM0 0v6.5L2.5 4l3 3L7 5.5l-3-3L6.5 0z"/>
<path
d="M16 0H9.5L12 2.5l-3 3L10.5 7l3-3L16 6.5zM16 16V9.5L13.5 12l-3-3L9 10.5l3 3L9.5 16zM0 16h6.5L4 13.5l3-3L5.5 9l-3 3L0 9.5zM0 0v6.5L2.5 4l3 3L7 5.5l-3-3L6.5 0z"
/>
</svg>
</span>
<span class="shrink" @click="$emit('shrinkcard')">
<span
class="shrink"
@click="$emit('shrinkcard')"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
role="img"
aria-label="Shrink the size of the card and show other tools. Updates URL to no longer be just for this tool."
>
<path d="M9 7h6.5L13 4.5l3-3L14.5 0l-3 3L9 .5zM9 9v6.5l2.5-2.5 3 3 1.5-1.5-3-3L15.5 9zM7 9H.5L3 11.5l-3 3L1.5 16l3-3L7 15.5zM7 7V.5L4.5 3l-3-3L0 1.5l3 3L.5 7z"/>
<path
d="M9 7h6.5L13 4.5l3-3L14.5 0l-3 3L9 .5zM9 9v6.5l2.5-2.5 3 3 1.5-1.5-3-3L15.5 9zM7 9H.5L3 11.5l-3 3L1.5 16l3-3L7 15.5zM7 7V.5L4.5 3l-3-3L0 1.5l3 3L.5 7z"
/>
</svg>
</span>
</div>

<div class="card-body">
<a
v-if="tool.logo && tool.url"
:href="tool.url" target="_blank" rel="noopener noreferrer"
:href="tool.url"
target="_blank"
rel="noopener noreferrer"
><img
:src="'_imgs/logos/' + tool.logo"
:alt="tool.title + ' logo'"
Expand Down Expand Up @@ -112,7 +129,12 @@
:key="'framework' + frameworkIndex"
>
{{ framework.framework }} -
<a v-if="framework.url" :href="framework.url" target="_blank" rel="noopener noreferrer">{{ framework.title }}</a>
<a
v-if="framework.url"
:href="framework.url"
target="_blank"
rel="noopener noreferrer"
>{{ framework.title }}</a>
<span v-else>{{ framework.title }}</span>
</li>
</ul>
Expand All @@ -127,7 +149,12 @@
:key="'subTool' + subToolIndex"
>
{{ subTool.type }} -
<a v-if="subTool.url" :href="subTool.url" target="_blank" rel="noopener noreferrer">{{ subTool.title }}</a>
<a
v-if="subTool.url"
:href="subTool.url"
target="_blank"
rel="noopener noreferrer"
>{{ subTool.title }}</a>
<span v-else>{{ subTool.title }}</span>
</li>
</ul>
Expand All @@ -142,7 +169,12 @@
:key="'tutorial' + tutorialIndex"
>
<strong>{{ tutorial.site }}</strong> -
<a v-if="tutorial.url" :href="tutorial.url" target="_blank" rel="noopener noreferrer">{{ tutorial.title }}</a>
<a
v-if="tutorial.url"
:href="tutorial.url"
target="_blank"
rel="noopener noreferrer"
>{{ tutorial.title }}</a>
<span v-else>{{ tutorial.title }}</span>
{{ ' ' }}
<em v-if="tutorial.author">by {{ tutorial.author }}</em>
Expand All @@ -156,7 +188,11 @@

<script>
export default {
name: 'base-card',
name: 'BaseCard',
emits: [
'expandcard',
'shrinkcard'
],
props: {
tool: {
type: Object,
Expand Down
2 changes: 1 addition & 1 deletion _components/github-corner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

<script>
export default {
name: 'github-corner'
name: 'GithubCorner'
};
</script>
12 changes: 5 additions & 7 deletions _components/minus.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<template>
<span
v-if="index === tool[name].length - 1"
@click="remove(name)"
class="minus"
@click="$emit('remove', name)"
>-</span>
</template>

<script>
export default {
name: 'minus',
name: 'MinusButton',
emits: [
'remove'
],
props: {
name: {
type: String,
Expand All @@ -22,11 +25,6 @@ export default {
type: Object,
required: true
}
},
methods: {
remove: function (section) {
this.tool[section].pop();
}
}
};
</script>
2 changes: 1 addition & 1 deletion _components/news-alerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<script>
export default {
name: 'news-alerts',
name: 'NewsAlerts',
data: function () {
return {
currentStory: 0,
Expand Down
2 changes: 1 addition & 1 deletion _components/site-logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

<script>
export default {
name: 'site-logo'
name: 'SiteLogo'
};
</script>
2 changes: 1 addition & 1 deletion _components/unreviewed-card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<script>
export default {
name: 'unreviewed-card',
name: 'UnreviewedCard',
data: function () {
return {
tools: [
Expand Down
4 changes: 3 additions & 1 deletion _scripts/admin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line no-unused-vars
const admin = Vue.createApp({
components: {
'site-logo': httpVueLoader('_components/site-logo.vue'),
Expand Down Expand Up @@ -128,6 +127,9 @@ const admin = Vue.createApp({
});

return itemsArray.join(', ');
},
minusByToolName: function (name) {
this.tool[name].pop();
}
},
filters: {
Expand Down
8 changes: 5 additions & 3 deletions _scripts/beautify-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function beautifyJSON (val) {

function getOwnEnumPropSymbols (object) {
return Object.getOwnPropertySymbols(object).filter(function (keySymbol) {
return object.propertyIsEnumerable(keySymbol);
return Object.prototype.propertyIsEnumerable.call(object, keySymbol);
});
}

Expand All @@ -34,13 +34,15 @@ function beautifyJSON (val) {
return '"[Circular]"';
}

if (val === null ||
if (
val === null ||
val === undefined ||
typeof val === 'number' ||
typeof val === 'boolean' ||
typeof val === 'function' ||
typeof val === 'symbol' ||
isRegexp(val)) {
isRegexp(val)
) {
return String(val);
}

Expand Down
11 changes: 3 additions & 8 deletions _scripts/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line no-unused-vars
let helpers = {
window.helpers = {
parseToolsData: function (responseData) {
let data = [];
let networkError = false;
Expand Down Expand Up @@ -157,7 +156,7 @@ let helpers = {
if (params.languages) {
try {
params.languages = JSON.parse(decodeURI(params.languages));
} catch (err) {
} catch {
console.log('Could not parse language filters: ' + params.languages);
}
if (!Array.isArray(params.languages)) {
Expand All @@ -168,7 +167,7 @@ let helpers = {
if (params.platforms) {
try {
params.platforms = JSON.parse(decodeURI(params.platforms));
} catch (err) {
} catch {
console.log('Could not parse platfrom filters: ' + params.platforms);
}
if (!Array.isArray(params.platforms)) {
Expand All @@ -184,10 +183,6 @@ let helpers = {
}
};

if (typeof(module) !== 'undefined') {
module.exports = helpers;
}

window.httpVueLoader = function (componentPath) {
const sfcLoaderOptions = {
moduleCache: {
Expand Down
16 changes: 8 additions & 8 deletions admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1>Admin Panel:</h1>
:key="'language' + languageIndex"
>
<input v-model="tool.languages[languageIndex]" type="text">
<minus :tool="tool" :index="languageIndex" name="languages"></minus>
<minus :tool="tool" :index="languageIndex" name="languages" @remove="minusByToolName"></minus>
</li>
<li>
<select v-model="newLanguageChoice">
Expand Down Expand Up @@ -88,7 +88,7 @@ <h1>Admin Panel:</h1>
:key="'platform' + platformIndex"
>
<input v-model="tool.platforms[platformIndex]" type="text">
<minus :tool="tool" :index="platformIndex" name="platforms"></minus>
<minus :tool="tool" :index="platformIndex" name="platforms" @remove="minusByToolName"></minus>
</li>
<li>
<select v-model="newPlatformChoice">
Expand Down Expand Up @@ -117,7 +117,7 @@ <h1>Admin Panel:</h1>
:key="'pro' + proIndex"
>
<input v-model="tool.pros[proIndex]" type="text">
<minus :tool="tool" :index="proIndex" name="pros"></minus>
<minus :tool="tool" :index="proIndex" name="pros" @remove="minusByToolName"></minus>
</li>
</ul>
</div>
Expand All @@ -133,7 +133,7 @@ <h1>Admin Panel:</h1>
:key="'con' + conIndex"
>
<input v-model="tool.cons[conIndex]" type="text">
<minus :tool="tool" :index="conIndex" name="cons"></minus>
<minus :tool="tool" :index="conIndex" name="cons" @remove="minusByToolName"></minus>
</li>
</ul>
</div>
Expand All @@ -159,7 +159,7 @@ <h1>Admin Panel:</h1>
<div>
<label>URL</label>
<input v-model="tool.frameworks[frameworkIndex].url" type="text">
<minus :tool="tool" :index="frameworkIndex" name="frameworks"></minus>
<minus :tool="tool" :index="frameworkIndex" name="frameworks" @remove="minusByToolName"></minus>
</div>
</li>
</div>
Expand All @@ -185,7 +185,7 @@ <h1>Admin Panel:</h1>
<div>
<label>URL</label>
<input v-model="tool.tools[toolToolIndex].url" type="text">
<minus :tool="tool" :index="toolToolIndex" name="tools"></minus>
<minus :tool="tool" :index="toolToolIndex" name="tools" @remove="minusByToolName"></minus>
</div>
</li>
</div>
Expand Down Expand Up @@ -215,7 +215,7 @@ <h1>Admin Panel:</h1>
<div>
<label>Site</label>
<input v-model="tool.tutorials[tutorialIndex].site" :placeholder="joinedItems('sites')" type="text">
<minus :tool="tool" :index="tutorialIndex" name="tutorials"></minus>
<minus :tool="tool" :index="tutorialIndex" name="tutorials" @remove="minusByToolName"></minus>
</div>
</li>
</div>
Expand All @@ -240,7 +240,7 @@ <h1>Admin Panel:</h1>
<div>
<label>Description:</lable><br />
<textarea v-model="tool.notableProjects[projectIndex].description"></textarea>
<minus :tool="tool" :index="projectIndex" name="notableProjects"></minus>
<minus :tool="tool" :index="projectIndex" name="notableProjects" @remove="minusByToolName"></minus>
</div>
</li>
</ul>
Expand Down
33 changes: 33 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import js from '@eslint/js';
import tjwBase from 'eslint-config-tjw-base';
import tjwVue from 'eslint-config-tjw-vue';
import pluginVue from 'eslint-plugin-vue';

const vue3Recommended = pluginVue.configs['flat/recommended'];

export default [
js.configs.recommended,
...vue3Recommended,
tjwBase,
tjwVue,
{
ignores: [
'/node_modules',
'/build/',
'/config/',
'/dist/',
'.eslintrc.js'
],
languageOptions: {
globals: {
axios: true,
beautifyJSON: true,
helpers: true,
httpVueLoader: true,
module: true,
Promise: true,
Vue: true
}
}
}
];
Loading

0 comments on commit 5b72647

Please sign in to comment.