Skip to content

Commit

Permalink
Merge pull request #152 from kintone-labs/SSR-3364-fix-eslint-waring-…
Browse files Browse the repository at this point in the history
…usestrict

SSR-3364: Fix ESLint warning of "use strict"
  • Loading branch information
nmanhit authored Aug 29, 2023
2 parents 2eba4e7 + fb1abb6 commit 67870b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
30 changes: 17 additions & 13 deletions src/commands/Initialize/sampleCode.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
const jsSample = `(function() {
const jsSampleUseStrict = `(function() {
'use strict';
kintone.events.on('app.record.index.show', function(event) {
console.log('Hello from kintone CLI');
return event;
});
})();
`;

const jsSample = `(function() {
kintone.events.on('app.record.index.show', function(event) {
console.log('Hello from kintone CLI');
return event;
});
})();
`;

const jsxSample = `import * as React from 'react'
import * as ReactDOM from 'react-dom'
Expand Down Expand Up @@ -43,20 +52,15 @@ const App = () => {
})();
`;

const generateSample = ({ useTypescript, useReact }): string => {
if (useReact) {
if (useTypescript) {
return tsxSample;
}

return jsxSample;
}
const generateSample = ({ useTypescript, useReact, useWebpack }): string => {
const env = useTypescript || useWebpack || useReact ? 'es2017' : 'es6';
const jsSampleInit = env === 'es6' ? jsSample : jsSampleUseStrict;

if (useTypescript) {
return tsSample;
}
if (useReact && useTypescript) return tsxSample;
if (useReact) return jsxSample;
if (useTypescript) return tsSample;

return jsSample;
return jsSampleInit;
};
export { generateSample };
export default generateSample;
1 change: 0 additions & 1 deletion src/commands/Initialize/test/generateTemplate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('Initialize command', () => {
test('Should be JS sample when neither React nor TypeScript is used', async () => {
const jsSample = `
(function() {
'use strict';
kintone.events.on('app.record.index.show', function(event) {
console.log('Hello from kintone CLI');
return event;
Expand Down

0 comments on commit 67870b9

Please sign in to comment.