Skip to content

Commit

Permalink
Forgot to commit the test transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
ehoogerbeets committed Feb 13, 2025
1 parent bcac20f commit 7208faf
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 52 deletions.
6 changes: 3 additions & 3 deletions packages/ilib-lint/src/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ class Project extends DirItem {
}

/**
* Return the serializer manager for this project.
* @returns {TransformerManager} the serializer
* Return the transformer manager for this project.
* @returns {TransformerManager} the transformer manager for this project
*/
getTransformerManager() {
const pluginMgr = this.options.pluginManager;
Expand All @@ -437,7 +437,7 @@ class Project extends DirItem {

/**
* Return the serializer manager for this project.
* @returns {SerializerManager} the serializer
* @returns {SerializerManager} the serializer manager for this project
*/
getSerializerManager() {
const pluginMgr = this.options.pluginManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* TestTransformer.js - test an ilib-lint Transformer plugin
*
* Copyright © 2025 JEDLSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Transformer, SourceFile } from 'ilib-lint-common';

class TestTransformer extends Transformer {
constructor(options) {
super(options);
this.overwrite = options?.opt?.overwrite ?? false;
this.name = "transformer-xyz";
this.description = "A test transformer for xyz files, which are really just json files.";
this.type = "resource";
}

init() {
console.log("TestTransformer.init called");
}

transform(ir, results) {
console.log("TestTransformer.transform called");
// just return the ir unchanged
return ir;
}
}

export default TestTransformer;
5 changes: 5 additions & 0 deletions packages/ilib-lint/test/ilib-lint-plugin-test/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import TestParser from './TestParser.js';
import TestRule from './TestRule.js';
import TestFormatter from './TestFormatter.js';
import TestFixer from './TestFixer.js';
import TestTransformer from './TestTransformer.js';
import TestSerializer from './TestSerializer.js';

class TestPlugin extends Plugin {
Expand Down Expand Up @@ -66,6 +67,10 @@ class TestPlugin extends Plugin {
return [ TestFixer ];
}

getTransformers() {
return [ TestTransformer ];
}

getSerializers() {
return [ TestSerializer ];
}
Expand Down
49 changes: 0 additions & 49 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7208faf

Please sign in to comment.