Skip to content

Use eslint v9 and eleventy v3. #52

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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: 12 additions & 12 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Imports
const markdownIt = require('markdown-it');
const {execSync} = require('child_process');
const legend = require('./src/_data/legend.json');
const BarRating = require('./_shortcodes/BarRating');
const markdownItAnchor = require('markdown-it-anchor');
const mermaidShortcode = require('./_shortcodes/mermaid');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const eleventyMermaidPlugin = require('@kevingimbel/eleventy-plugin-mermaid');
const mermaidFullscreenJsShortcode =
require('./_shortcodes/mermaid_fullscreen_js');
import BarRating from './_shortcodes/BarRating.js';
import eleventyMermaidPlugin from '@kevingimbel/eleventy-plugin-mermaid';
import {execSync} from 'node:child_process';
import legend from './src/_data/legend.json' with {type: 'json'};
import markdownIt from 'markdown-it';
import markdownItAnchor from 'markdown-it-anchor';
import mermaidFullscreenJsShortcode from
'./_shortcodes/mermaid_fullscreen_js.js';
import mermaidShortcode from './_shortcodes/mermaid.js';
import syntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight';

// Constants
const statusMarks = legend.reduce((all, statusMark) => {
Expand All @@ -22,7 +22,7 @@ const statusLabel = legend.reduce((all, statusMark) => {
}, {});

// Eleventy Configurations
module.exports = function(eleventyConfig) {
export default function(eleventyConfig) {
/* Markdown Overrides */
const markdownLibrary = markdownIt({
html: true,
Expand Down Expand Up @@ -91,4 +91,4 @@ module.exports = function(eleventyConfig) {
layouts: '_layouts',
},
};
};
}
28 changes: 0 additions & 28 deletions .eslintrc.cjs

This file was deleted.

9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*.sw[nop]
*~
.DS_Store
.cache/
.project
.settings
.vscode/
_site/*
node_modules/
package-lock.json
.cache/
.vscode/
2 changes: 1 addition & 1 deletion _shortcodes/BarRating.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ function BarRating(passed, pending, failed, total, width) {
`;
}

module.exports = BarRating;
export default BarRating;
2 changes: 1 addition & 1 deletion _shortcodes/mermaid.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = content => {
export default content => {
return `<div style="position: relative">
<span class="ui top right attached blue icon label">
<i class="expand icon"></i>
Expand Down
2 changes: 1 addition & 1 deletion _shortcodes/mermaid_fullscreen_js.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = () => {
export default () => {
const src = 'https://unpkg.com/mermaid@10/dist/mermaid.esm.min.mjs';
return `<script type="module" async>
import mermaid from '${src}';
Expand Down
34 changes: 34 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import globals from 'globals';

import digitalbazaar from 'eslint-config-digitalbazaar';
import digitalbazaarJsdoc from 'eslint-config-digitalbazaar/jsdoc';
import digitalbazaarModule from 'eslint-config-digitalbazaar/module';

export default [
...digitalbazaar,
...digitalbazaarJsdoc,
...digitalbazaarModule,
{
ignores: ['_site', '!.eleventy.js'],
},
{
languageOptions: {
globals: {
...globals.node
}
},
rules: {
'unicorn/prefer-node-protocol': 'error'
}
},
{
files: [
'src/assets/js/*'
],
languageOptions: {
globals: {
...globals.browser
}
}
}
];
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "canivc",
"version": "0.0.0",
"description": "Community compatibility dashboard for Verifiable Credentials.",
"main": "index.js",
"type": "module",
"scripts": {
"build": "eleventy",
"lint": "eslint .",
"lint": "eslint",
"serve": "rm -rf _site/ && eleventy --serve",
"start": "rm -rf _site/ && eleventy --serve",
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -20,19 +20,19 @@
"author": "Digital Bazaar, Inc.",
"license": "BSD-3-Clause",
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-fetch": "^4.0.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"@kevingimbel/eleventy-plugin-mermaid": "^2.1.0",
"eslint": "^8.52.0",
"eslint-config-digitalbazaar": "^5.0.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-unicorn": "^48.0.1",
"pagefind": "^1.0.4"
"@11ty/eleventy": "^3.1.2",
"@11ty/eleventy-fetch": "^5.1.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.2",
"@kevingimbel/eleventy-plugin-mermaid": "^3.0.0",
"eslint": "^9.33.0",
"eslint-config-digitalbazaar": "github:digitalbazaar/eslint-config-digitalbazaar#use-eslint-v9",
"eslint-plugin-jsdoc": "^52.0.4",
"eslint-plugin-unicorn": "^60.0.0",
"pagefind": "^1.3.0"
},
"dependencies": {
"markdown-it-anchor": "^8.6.7",
"sass": "^1.66.0",
"markdown-it-anchor": "^9.2.0",
"sass": "^1.90.0",
"w3c-ccg-vc-test-suite-implementations": "github:w3c-ccg/vc-api-test-suite-implementations",
"w3c-vc-test-suite-implementations": "github:w3c/vc-test-suite-implementations"
}
Expand Down
2 changes: 1 addition & 1 deletion src/_data/implementations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = async () => {
export default async () => {
const {
allImplementations: vcwgImplementations
} = await import('w3c-vc-test-suite-implementations');
Expand Down
6 changes: 3 additions & 3 deletions src/_data/results.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const EleventyFetch = require('@11ty/eleventy-fetch');
import EleventyFetch from '@11ty/eleventy-fetch';

const specUrls = [
'https://w3c.github.io/vc-data-model-2.0-test-suite/index.json',
Expand Down Expand Up @@ -209,7 +209,7 @@ function removeSomeTestSections(results) {
}

// Repeated fetch
module.exports = async function() {
export default async function() {
/* This returns a promise */
const promises = specUrls.map(url =>
EleventyFetch(url, {
Expand Down Expand Up @@ -244,4 +244,4 @@ module.exports = async function() {
]
}))
};
};
}
2 changes: 1 addition & 1 deletion src/assets/js/spiderCharts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global document, Chart */
/* global Chart */
const ctx = Array.from(document.querySelectorAll('.spider-chart'));

// Chart global defaults
Expand Down