Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Porter <jason@union.ai>
  • Loading branch information
jsonporter committed Feb 20, 2024
1 parent 4e98b7c commit 2e3ee0e
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 71 deletions.
8 changes: 2 additions & 6 deletions .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,12 @@ function getProdConfiguration() {
* ################################################################
*/
function isTestRun() {
return (
process.argv.includes('--dry-run') || process.argv.includes('--test-run')
);
return process.argv.includes('--dry-run') || process.argv.includes('--test-run');
}

function getTestConfiguration() {
const localGitRepoPath = `file://${process.cwd()}/.git`;
const localBranchName = execSync('git branch --show-current')
.toString()
.trim();
const localBranchName = execSync('git branch --show-current').toString().trim();

return {
repositoryUrl: localGitRepoPath,
Expand Down
15 changes: 3 additions & 12 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ module.exports = {
// flyteidl.d.ts file.
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
'babel-loader',
{ loader: 'ts-loader', options: { transpileOnly: true } },
],
use: ['babel-loader', { loader: 'ts-loader', options: { transpileOnly: true } }],
},
];

Expand All @@ -32,14 +29,8 @@ module.exports = {
'@flyteorg/console': path.resolve(__dirname, '../packages/console/src'),
'@flyteorg/locale': path.resolve(__dirname, '../packages/locale/src'),
'@flyteorg/ui-atoms': path.resolve(__dirname, '../packages/ui-atoms/src'),
'@flyteorg/components': path.resolve(
__dirname,
'../packages/components/src',
),
'@flyteorg/flyte-api': path.resolve(
__dirname,
'../packages/flyte-api/src',
),
'@flyteorg/components': path.resolve(__dirname, '../packages/components/src'),
'@flyteorg/flyte-api': path.resolve(__dirname, '../packages/flyte-api/src'),
};

return config;
Expand Down
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const parameters = {
};

export const decorators = [
Story => (
(Story) => (
<StorybookContainer>
<Story />
</StorybookContainer>
Expand Down
15 changes: 3 additions & 12 deletions script/generator/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,19 @@ const __dirname = path.dirname(__filename);
export const projectTypeSoSettingsMap = {
basics: {
packagePartialPath: 'packages/basics/',
targetDirectoryPartialPath: path.resolve(
__dirname,
'../../../packages/basics/',
),
targetDirectoryPartialPath: path.resolve(__dirname, '../../../packages/basics/'),
// using the same template for basics, components and microapps for now
templateDirectory: path.resolve(__dirname, '../templates', 'basics'),
},
composites: {
packagePartialPath: 'packages/composites/',
targetDirectoryPartialPath: path.resolve(
__dirname,
'../../../packages/composites/',
),
targetDirectoryPartialPath: path.resolve(__dirname, '../../../packages/composites/'),
// using the same template for basics, components and microapps for now
templateDirectory: path.resolve(__dirname, '../templates', 'basics'),
},
plugins: {
packagePartialPath: 'packages/plugins/',
targetDirectoryPartialPath: path.resolve(
__dirname,
'../../../packages/plugins/',
),
targetDirectoryPartialPath: path.resolve(__dirname, '../../../packages/plugins/'),
// using the same template for basics, components and microapps for now
templateDirectory: path.resolve(__dirname, '../templates', 'basics'),
},
Expand Down
18 changes: 5 additions & 13 deletions script/generator/src/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { projectTypeSoSettingsMap } from './constants.js';

const askQuestions = async () => {
console.log(
chalk.hex('#e7c99a')(
'Use the up and down arrow keys to navigate multi-choice questions',
),
chalk.hex('#e7c99a')('Use the up and down arrow keys to navigate multi-choice questions'),
);

const questionsSetProjectType = [
Expand Down Expand Up @@ -40,7 +38,7 @@ const askQuestions = async () => {
name: 'name',
type: 'input',
message: 'Project name(folder): ',
validate: projectName => {
validate: (projectName) => {
let valid = true;

/* Reg ex to ensure that project name starts with a letter, includes letters, numbers, underscores and hashes */
Expand Down Expand Up @@ -76,16 +74,10 @@ const askQuestions = async () => {

const projectType = answersA.type;

const {
targetDirectoryPartialPath,
templateDirectory,
packagePartialPath,
} = projectTypeSoSettingsMap[projectType];
const { targetDirectoryPartialPath, templateDirectory, packagePartialPath } =
projectTypeSoSettingsMap[projectType];

const questionsB = getQuestionsSetFolderName(
templateDirectory,
targetDirectoryPartialPath,
);
const questionsB = getQuestionsSetFolderName(templateDirectory, targetDirectoryPartialPath);
const answersB = await inquirer.prompt(questionsB);

const projectName = answersB.name;
Expand Down
23 changes: 8 additions & 15 deletions script/generator/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs';

const checkPathExists = pathToCheck => {
const checkPathExists = (pathToCheck) => {
try {
return fs.existsSync(pathToCheck);
} catch (err) {
Expand All @@ -21,20 +21,13 @@ async function editPackageJSON(options) {
jsonFile.name = `@flyteorg/${options.name}`;
jsonFile.description = options.description;

jsonFile.scripts.test = jsonFile.scripts.test.replace(
'folder-path',
options.testPath,
);

fs.writeFile(
`${targetDir}/package.json`,
JSON.stringify(jsonFile, null, '\t'),
err2 => {
if (err2) {
throw new Error('Unable to update package.json');
}
},
);
jsonFile.scripts.test = jsonFile.scripts.test.replace('folder-path', options.testPath);

fs.writeFile(`${targetDir}/package.json`, JSON.stringify(jsonFile, null, '\t'), (err2) => {
if (err2) {
throw new Error('Unable to update package.json');
}
});
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ export const Primary: ComponentStory<typeof SampleComponent> = () => {
return <SampleComponent />;
};

const Template: ComponentStory<typeof SampleComponent> = () => (
<SampleComponent />
);
const Template: ComponentStory<typeof SampleComponent> = () => <SampleComponent />;
export const Secondary = Template.bind({});
2 changes: 1 addition & 1 deletion script/test/assetsTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ const path = require('path');

module.exports = {
process(_src, filename, _config, _options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};
9 changes: 1 addition & 8 deletions script/test/jest.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['../../script/test/jest-setup.ts'],
testPathIgnorePatterns: [
'__stories__',
'.storybook',
'/node_modules/',
'dist',
'lib',
'build',
],
testPathIgnorePatterns: ['__stories__', '.storybook', '/node_modules/', 'dist', 'lib', 'build'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
transform: {
'^.+\\.(j|t)sx?$': 'ts-jest',
Expand Down

0 comments on commit 2e3ee0e

Please sign in to comment.