Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ffb31d1
feat(eslint): migrate to ESLint v10
YusukeHirao Feb 9, 2026
c6a54a5
fix(stylelint-rules): fix no-useless-assignment in prefer-individual-…
YusukeHirao Feb 9, 2026
8098b75
chore(eslint-plugin): bump eslint and typescript-eslint dependencies …
YusukeHirao Aug 14, 2026
fd30858
chore(eslint): bump eslint, typescript-eslint and eslint-comments plugin
YusukeHirao Aug 14, 2026
e1de601
Merge branch 'dev' into feat/eslint-v10
YusukeHirao Aug 24, 2026
bd3ca1b
Merge remote-tracking branch 'origin/dev' into feat/eslint-v10
YusukeHirao Sep 1, 2026
bf9ef22
chore(eslint-plugin): bump eslint to 10.9.1
YusukeHirao Sep 1, 2026
417c512
fix(eslint-plugin): rename abbreviated argument names per unicorn/nam…
YusukeHirao Sep 1, 2026
8cc440a
fix(csstree-scss-syntax): resolve eslint-plugin-unicorn v74 violations
YusukeHirao Sep 1, 2026
be5c46a
fix(cz): rename abbreviated variable name per unicorn/name-replacements
YusukeHirao Sep 1, 2026
60c4963
fix(lint-staged): resolve eslint-plugin-unicorn v74 violations
YusukeHirao Sep 1, 2026
3214c5a
fix(markuplint): use https urls per unicorn/prefer-https
YusukeHirao Sep 1, 2026
5c81204
chore(eslint): bump @eslint/compat, eslint, eslint-plugin-jsdoc and e…
YusukeHirao Sep 1, 2026
7163405
test(eslint): update prefer-top-level-await fixture for eslint-plugin…
YusukeHirao Sep 1, 2026
0b15674
fix(commitlint): prefer try/catch over promise chaining per unicorn/p…
YusukeHirao Sep 1, 2026
d1d9056
fix(stylelint-rules): resolve eslint-plugin-unicorn v74 violations
YusukeHirao Sep 1, 2026
93468d2
fix(stylelint): use multiline block comment per unicorn/single-line-b…
YusukeHirao Sep 1, 2026
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
10 changes: 8 additions & 2 deletions packages/@d-zero/commitlint-config/get-cz-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ export async function getCZConfig() {
return null;
}

const modPath = czConfigPath.replace(/^(?:\.\/)?node_modules\//, '');
const modulePath = czConfigPath.replace(/^(?:\.\/)?node_modules\//, '');

const czConfig = await import(modPath).catch(() => null);
let czConfig;

try {
czConfig = await import(modulePath);
} catch {
return null;
}

return czConfig?.default ?? czConfig ?? null;
}
3 changes: 3 additions & 0 deletions packages/@d-zero/csstree-scss-syntax/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const forked = CSSTree.fork(
...scope,
Value: {
...scope.Value,
// `this` is the css-tree parser context bound at call time, not a class instance.
/* eslint-disable unicorn/no-this-outside-of-class */
// @ts-ignore
getNode: function (context) {
// @ts-ignore
Expand All @@ -39,6 +41,7 @@ const forked = CSSTree.fork(

return getNode.call(this, context);
},
/* eslint-enable unicorn/no-this-outside-of-class */
},
},
node: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export default {
structure: {
name: String,
},
// `this` is the css-tree parser context bound at call time, not a class instance.
/* eslint-disable unicorn/no-this-outside-of-class */
// @ts-ignore
parse: function SassVariable() {
// @ts-ignore
Expand All @@ -22,6 +24,7 @@ export default {
name: this.consume(IDENTIFIER),
};
},
/* eslint-enable unicorn/no-this-outside-of-class */
// @ts-ignore
generate: function (node) {
return '$' + node.name;
Expand Down
6 changes: 3 additions & 3 deletions packages/@d-zero/csstree-scss-syntax/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export type CSSTreeModule = typeof CSSTree & {
findAll: typeof CSSTree.findAll;
fromPlainObject: typeof CSSTree.fromPlainObject;
toPlainObject: typeof CSSTree.toPlainObject;
fork(...args: Parameters<typeof CSSTree.fork>): CSSTreeModule;
fork(...arguments_: Parameters<typeof CSSTree.fork>): CSSTreeModule;
fork(
fn: (syntax: CSSTreeModule, assign: typeof Object.assign) => CSSTreeModule,
function_: (syntax: CSSTreeModule, assign: typeof Object.assign) => CSSTreeModule,
): CSSTreeModule;
};

interface LexerEx extends CSSTree.Lexer {
matchProperty(
...args: Parameters<CSSTree.Lexer['matchProperty']>
...arguments_: Parameters<CSSTree.Lexer['matchProperty']>
): LexerMatchResultMatched | LexerMatchResultMismatch;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/@d-zero/cz-config/monorepo-scopes.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = function (removes) {
if (!packageJson) {
return null;
}
const pkg = JSON.parse(packageJson);
let name = pkg.name;
const package_ = JSON.parse(packageJson);
let name = package_.name;
for (const remove of removes) {
name = name.replace(remove, '');
}
Expand Down
17 changes: 13 additions & 4 deletions packages/@d-zero/eslint-config/base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dzeroPlugin from '@d-zero/eslint-plugin';
import { fixupPluginRules } from '@eslint/compat';
import js from '@eslint/js';
import comments from 'eslint-plugin-eslint-comments';
import comments from '@eslint-community/eslint-plugin-eslint-comments';
import { flatConfigs as importX } from 'eslint-plugin-import-x';
import jsdoc from 'eslint-plugin-jsdoc';
import * as regexpPlugin from 'eslint-plugin-regexp';
Expand Down Expand Up @@ -73,6 +74,10 @@
regexpPlugin.configs['flat/recommended'],
{
...importX.recommended,
plugins: {
...importX.recommended.plugins,
'import-x': fixupPluginRules(importX.recommended.plugins['import-x']),
},
rules: {
...importX.recommended.rules,
'import-x/no-extraneous-dependencies': 2,
Expand Down Expand Up @@ -108,9 +113,13 @@
},
},
{
...jsdoc.configs['flat/recommended'],

Check warning on line 116 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (windows-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead

Check warning on line 116 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead
plugins: {
...jsdoc.configs['flat/recommended'].plugins,

Check warning on line 118 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (windows-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead

Check warning on line 118 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead
jsdoc: fixupPluginRules(jsdoc.configs['flat/recommended'].plugins.jsdoc),

Check warning on line 119 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (windows-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead

Check warning on line 119 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead
},
rules: {
...jsdoc.configs['flat/recommended'].rules,

Check warning on line 122 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (windows-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead

Check warning on line 122 in packages/@d-zero/eslint-config/base.js

View workflow job for this annotation

GitHub Actions / test (macOS-latest, 24)

Caution: `jsdoc` also has a named export `configs`. Check if you meant to write `import {configs} from 'eslint-plugin-jsdoc'` instead
'jsdoc/require-param-type': 0,
'jsdoc/require-param-description': 0,
'jsdoc/require-returns': 0,
Expand All @@ -120,13 +129,13 @@
},
{
plugins: {
comments,
comments: fixupPluginRules(comments),
},
},
{
plugins: {
comments,
'sort-class-members': sortClassMembers,
comments: fixupPluginRules(comments),
'sort-class-members': fixupPluginRules(sortClassMembers),
},
rules: {
'sort-class-members/sort-class-members': [
Expand Down
11 changes: 6 additions & 5 deletions packages/@d-zero/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
},
"dependencies": {
"@d-zero/eslint-plugin": "5.0.0",
"@eslint/js": "9.39.5",
"eslint": "9.39.5",
"eslint-plugin-eslint-comments": "3.2.0",
"@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
"@eslint/compat": "2.1.0",
"@eslint/js": "10.0.1",
"eslint": "10.9.1",
"eslint-plugin-import-x": "4.17.1",
"eslint-plugin-jsdoc": "64.2.1",
"eslint-plugin-jsdoc": "64.3.2",
"eslint-plugin-regexp": "3.2.0",
"eslint-plugin-sort-class-members": "1.22.1",
"eslint-plugin-unicorn": "63.0.0",
"eslint-plugin-unicorn": "74.0.0",
"globals": "17.11.0",
"typescript-eslint": "8.68.0"
}
Expand Down
1 change: 0 additions & 1 deletion packages/@d-zero/eslint-config/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const ts = tsESLint.config(
'@typescript-eslint/no-namespace': [2, { allowDeclarations: true }],
'@typescript-eslint/no-unnecessary-type-assertion': 2,
'@typescript-eslint/no-unused-vars': 2,
'@typescript-eslint/no-var-requires': 2,
'@typescript-eslint/prefer-namespace-keyword': 2,
'@typescript-eslint/require-await': 2,
'@typescript-eslint/restrict-plus-operands': 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/@d-zero/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"devDependencies": {
"@typescript-eslint/parser": "8.68.0",
"@typescript-eslint/rule-tester": "8.68.0",
"eslint": "9.39.5",
"eslint": "10.9.1",
"vue-eslint-parser": "10.4.1"
}
}
18 changes: 13 additions & 5 deletions packages/@d-zero/eslint-plugin/src/rules/no-click-event/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ export default createRule({
'CallExpression[callee.property.name="addEventListener"]'(
node: TSESTree.CallExpression,
) {
const args = node.arguments;
const firstArg = args[0];
if (firstArg && firstArg.type === 'Literal' && firstArg.value === 'click') {
const arguments_ = node.arguments;
const firstArgument = arguments_[0];
if (
firstArgument &&
firstArgument.type === 'Literal' &&
firstArgument.value === 'click'
) {
context.report({
node,
messageId: 'noClickEvent',
Expand All @@ -46,8 +50,12 @@ export default createRule({
'CallExpression[callee.type="MemberExpression"][callee.property.name="on"]'(
node: TSESTree.CallExpression,
) {
const firstArg = node.arguments[0];
if (firstArg && firstArg.type === 'Literal' && firstArg.value === 'click') {
const firstArgument = node.arguments[0];
if (
firstArgument &&
firstArgument.type === 'Literal' &&
firstArgument.value === 'click'
) {
context.report({
node,
messageId: 'noClickEvent',
Expand Down
109 changes: 63 additions & 46 deletions packages/@d-zero/lint-staged-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,76 +21,93 @@ export type IgnoreMap = Partial<Record<CommandType, string | string[]>>;

/**
*
* @param dirOptions
* @param directoryOptions
* @param mapping
*/
export default function (
dirOptions?: string | DirectoryOptions,
directoryOptions?: string | DirectoryOptions,
mapping?: CommandMappings,
): LintStagedCommandMapper {
return (allStagedFiles) => {
const commandList: string[] = [];
const cwd = process.cwd();

const dir = typeof dirOptions === 'string' ? dirOptions : dirOptions?.dir;
const ignore = typeof dirOptions === 'string' ? null : dirOptions?.ignore;
const directory =
typeof directoryOptions === 'string' ? directoryOptions : directoryOptions?.dir;
const ignore = typeof directoryOptions === 'string' ? null : directoryOptions?.ignore;

const baseDir = dir
const baseDirectory = directory
? // 絶対パスかどうか
path.isAbsolute(dir)
path.isAbsolute(directory)
? // 絶対パスならそのまま
dir
directory
: // 相対パスなら絶対パスに変換
path.resolve(cwd, dir)
path.resolve(cwd, directory)
: // 引数がないならカレントディレクトリ
cwd;

mapping = mapping ?? defaultMapping;
mapping ??= defaultMapping;

/**
*
* @param extension
* @param commandType
*/
function buildCommand(
extension: string,
commandType: CommandType,
): string | undefined {
const shell = commands[commandType];

if (!shell) {
return undefined;
}

const pattern = path
.resolve(baseDirectory, '**', `{*.${extension},.*.${extension}}`)
.replaceAll(path.sep, '/');

for (const [ext, commandTypes] of Object.entries(mapping)) {
for (const commandType of commandTypes) {
const shell = commands[commandType];
const files = allStagedFiles.map((f) => f.replaceAll(path.sep, '/'));

if (!shell) {
continue;
let targetFiles = files.filter((file) => path.matchesGlob(file, pattern));

if (ignore) {
for (const ignoreMap of ignore) {
const ignorePattern =
typeof ignoreMap === 'string' ? ignoreMap : ignoreMap[commandType];
if (!ignorePattern) {
continue;
}
const ignorePatterns = Array.isArray(ignorePattern)
? ignorePattern
: [ignorePattern];
const absIgnorePatterns = ignorePatterns.map((p) => {
if (p === path.basename(p)) {
return path.resolve('**', p).replaceAll(path.sep, '/');
}
return path.isAbsolute(p) ? p : path.resolve(baseDirectory, p);
});
targetFiles = targetFiles.filter((file) =>
absIgnorePatterns.every((pattern) => !path.matchesGlob(file, pattern)),
);
}
}

const pattern = path
.resolve(baseDir, '**', `{*.${ext},.*.${ext}}`)
.replaceAll(path.sep, '/');
if (targetFiles.length === 0) {
return undefined;
}

const files = allStagedFiles.map((f) => f.replaceAll(path.sep, '/'));
return shell + ' ' + targetFiles.map((f) => `"${f}"`).join(' ');
}

let targetFiles = files.filter((file) => path.matchesGlob(file, pattern));
const commandList: string[] = [];

if (ignore) {
for (const ignoreMap of ignore) {
const ignorePattern =
typeof ignoreMap === 'string' ? ignoreMap : ignoreMap[commandType];
if (!ignorePattern) {
continue;
}
const ignorePatterns = Array.isArray(ignorePattern)
? ignorePattern
: [ignorePattern];
const absIgnorePatterns = ignorePatterns.map((p) => {
if (p === path.basename(p)) {
return path.resolve('**', p).replaceAll(path.sep, '/');
}
return path.isAbsolute(p) ? p : path.resolve(baseDir, p);
});
targetFiles = targetFiles.filter(
(file) =>
!absIgnorePatterns.some((pattern) => path.matchesGlob(file, pattern)),
);
}
}
for (const [extension, commandTypes] of Object.entries(mapping)) {
for (const commandType of commandTypes) {
const command = buildCommand(extension, commandType);

if (targetFiles.length <= 0) {
continue;
if (command) {
commandList.push(command);
}

commandList.push(shell + ' ' + targetFiles.map((f) => `"${f}"`).join(' '));
}
}

Expand Down
8 changes: 1 addition & 7 deletions packages/@d-zero/lint-staged-config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ export type TargetFileExtension =
| 'yml';

export type CommandType =
| 'cspell'
| 'eslint'
| 'markuplint'
| 'prettier'
| 'puglint'
| 'stylelint'
| 'textlint';
'cspell' | 'eslint' | 'markuplint' | 'prettier' | 'puglint' | 'stylelint' | 'textlint';

export type CommandMappings = Readonly<
Partial<Record<TargetFileExtension, CommandType[]>>
Expand Down
2 changes: 1 addition & 1 deletion packages/@d-zero/markuplint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
{
selector: 'html',
rules: {
// <html prefix="og: http://ogp.me/ns#">
// <html prefix="og: https://ogp.me/ns#">
'invalid-attr': {
options: {
allowAttrs: [
Expand Down
6 changes: 3 additions & 3 deletions packages/@d-zero/markuplint-config/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const nameBase = {
severity: 'error',
value: '/^c-(?<ComponentName>[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/',
reason:
'クラス名の形式はディーゼロのコーディングガイドラインに則って命名する必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%F0%9F%92%8E-%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88',
'クラス名の形式はディーゼロのコーディングガイドラインに則って命名する必要があります。 https://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%F0%9F%92%8E-%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88',
},
},
childNodeRules: [
Expand All @@ -26,7 +26,7 @@ const nameBase = {
'/^c-{{ ComponentName }}[a-z0-9]*(?:-[a-z0-9]+)*$/',
],
reason:
'ディーゼロのコーディングガイドラインではコンポーネントの中はそのコンポーネントのエレメントか、他のコンポーネントである必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88%E3%81%AE%E6%A7%8B%E6%88%90%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E5%91%BD%E5%90%8D%E8%A6%8F%E5%89%87',
'ディーゼロのコーディングガイドラインではコンポーネントの中はそのコンポーネントのエレメントか、他のコンポーネントである必要があります。 https://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88%E3%81%AE%E6%A7%8B%E6%88%90%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E5%91%BD%E5%90%8D%E8%A6%8F%E5%89%87',
},
},
},
Expand All @@ -38,7 +38,7 @@ const nameBase = {
severity: 'error',
value: '/^(?!c-).+$|^$/',
reason:
'ディーゼロのコーディングガイドラインでは「c-content-main」の中は「c-」で始めないルールとなっています。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%A8%E3%83%AC%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%AE%E4%BE%8B%E5%A4%96%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB',
'ディーゼロのコーディングガイドラインでは「c-content-main」の中は「c-」で始めないルールとなっています。 https://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%A8%E3%83%AC%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%AE%E4%BE%8B%E5%A4%96%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB',
},
},
},
Expand Down
Loading