Skip to content

Commit

Permalink
eslint refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAven committed Aug 26, 2024
1 parent e0d8d52 commit 5595b7e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import fs from 'fs';
import gendiff from '../index.js';
import gendiff from '../index.js'; // eslint-disable-line

let resultStylish; // eslint-disable-line
let resultPlain; // eslint-disable-line

beforeAll(() => {
beforeAll(() => { // eslint-disable-line
resultStylish = fs.readFileSync('./__fixtures__/resultStylish.txt'); // eslint-disable-line
resultPlain = fs.readFileSync('./__fixtures__/resultPlain.txt'); // eslint-disable-line
});

describe('get different from two files', () => {
test.each([
describe('get different from two files', () => { // eslint-disable-line
test.each([ // eslint-disable-line
['yml'],
['json'],

])('files format - %p', (extension) => {
const fileOneFullPath = `${process.cwd()}/__fixtures__/file1.${extension}`;
const FileTwoFullPath = `${process.cwd()}/__fixtures__/file2.${extension}`;
expect(gendiff(fileOneFullPath, FileTwoFullPath, 'stylish')).toEqual(resultStylish.toString());
expect(gendiff(fileOneFullPath, FileTwoFullPath, 'plain')).toEqual(resultPlain.toString());
expect(gendiff(fileOneFullPath, FileTwoFullPath)).toEqual(resultStylish.toString());
expect(gendiff(fileOneFullPath, FileTwoFullPath, 'stylish')).toEqual(resultStylish.toString()); // eslint-disable-line
expect(gendiff(fileOneFullPath, FileTwoFullPath, 'plain')).toEqual(resultPlain.toString()); // eslint-disable-line
expect(gendiff(fileOneFullPath, FileTwoFullPath)).toEqual(resultStylish.toString()); // eslint-disable-line
});
});
4 changes: 2 additions & 2 deletions bin/gendiff.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import commander from 'commander';
import gendiff from '../index.js';
import gendiff from '../index.js'; // eslint-disable-line

commander
.name('gendiff') //
Expand All @@ -11,7 +11,7 @@ commander
.arguments('<filepath1> <filepath2>')
.action((filepath1, filepath2) => {
const diff = gendiff(filepath1, filepath2, commander.format);
console.log(diff);
console.log(diff); // eslint-disable-line
});

commander.parse(process.argv);
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import gendiff from './src/index.js';
import gendiff from './src/index.js'; // eslint-disable-line

export default gendiff;
4 changes: 2 additions & 2 deletions src/formatters/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import stylish from './stylish.js';
import plain from './plain.js';
import stylish from './stylish.js'; // eslint-disable-line
import plain from './plain.js'; // eslint-disable-line

const formatter = (result, format) => {
switch (format) {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path';
import fs from 'fs';
import parse from './parsers/parsers.js';
import buildDiff from './compare.js';
import format from './formatters/index.js';
import parse from './parsers/parsers.js'; // eslint-disable-line
import buildDiff from './compare.js'; // eslint-disable-line
import format from './formatters/index.js'; // eslint-disable-line

const gendiff = (firstPath, secondPath, formatName = 'stylish') => {
const firstFilePath = path.resolve(process.cwd(), firstPath);
Expand Down

0 comments on commit 5595b7e

Please sign in to comment.