Skip to content
Open
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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017-2021 Akihiko Kusanagi
Copyright (c) 2017-2025 Akihiko Kusanagi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
['@simonbrunel/vuepress-plugin-versions', {
filters: {
suffix: (tag) => tag ? ` (${tag})` : '',
title: (v, vars) => window.location.href.includes('master') ? 'Development (master)' : v + (vars.tag ? ` (${tag})` : ''),
title: (v, vars) => window.location.href.includes('master') ? 'Development (master)' : v + (vars.tag ? ` (${vars.tag})` : ''),
link: (v, vars) => vars.prerelease ? 'next' : v
},
menu: {
Expand Down
117 changes: 117 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// Flat ESLint config for ESLint v9 (ESM)
// Covers JS, TypeScript (in types/), and Markdown files

import js from '@eslint/js';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import markdown from 'eslint-plugin-markdown';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
// Global ignores (migrated from .eslintignore)
{
ignores: [
'dist/**/*.js',
'dist/**/*.html',
'docs/scripts/chartjs-chart-financial.js',
],
},

// JavaScript files
js.configs.recommended,
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
},
},

// Node.js environment files
{
files: ['rollup.config.js', 'scripts/**/*.js', 'eslint.config.*', 'docs/.vuepress/**/*.js'],
languageOptions: {
sourceType: 'commonjs',
globals: {
require: 'readonly',
module: 'readonly',
process: 'readonly',
console: 'readonly',
__dirname: 'readonly',
// VuePress config may access window at runtime on client
window: 'readonly',
},
},
},

// Browser environment files
{
files: ['src/**/*.js'],
languageOptions: {
globals: {
window: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
setTimeout: 'readonly',
},
},
},

// TypeScript declaration files under types/
{
files: ['types/**/*.ts'],
languageOptions: {
parser: tsParser,
ecmaVersion: 2021,
sourceType: 'module',
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
// Start from the recommended rule set if available
...(tsPlugin.configs && tsPlugin.configs.recommended
? tsPlugin.configs.recommended.rules
: {}),
// Declaration files often intentionally redeclare and use empty interfaces for augmentation
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},

// Lint Markdown files using the markdown processor
{
files: ['**/*.md'],
plugins: {
markdown,
},
processor: 'markdown/markdown',
},

// Relax rules for code blocks extracted from Markdown
{
files: ['**/*.md/*.js', '**/*.md/*.ts'],
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
},
},

// Use TS parser for TypeScript code blocks in Markdown
{
files: ['**/*.md/*.ts'],
languageOptions: {
parser: tsParser,
ecmaVersion: 2021,
sourceType: 'module',
},
plugins: {
'@typescript-eslint': tsPlugin,
},
},
];


Loading