-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Drackin/master
feat: add more linting options and fix bugs
- Loading branch information
Showing
9 changed files
with
148 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": [ | ||
"@antfu", | ||
"prettier" | ||
], | ||
"rules": { | ||
"indent": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"undef": true, | ||
"unused": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "tslint:recommended", | ||
"rules": { | ||
"new-parens": true, | ||
"no-arg": true, | ||
"no-bitwise": true, | ||
"no-conditional-assignment": true, | ||
"no-consecutive-blank-lines": false, | ||
"no-console": { | ||
"severity": "warning", | ||
"options": ["debug", "info", "log", "time", "timeEnd", "trace"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import fs from 'fs' | ||
import { resolve } from 'path' | ||
|
||
const extrasRoot = resolve(__dirname, '..', 'extras') | ||
|
||
export const installESLint = (packageDir: string) => { | ||
// Parse package.json, add eslint dependencies and scripts | ||
const packageJson = JSON.parse(fs.readFileSync(`${packageDir}/package.json`, 'utf8')) | ||
|
||
packageJson.devDependencies.eslint = '*' | ||
packageJson.devDependencies['@antfu/eslint-config'] = '*' | ||
packageJson.devDependencies.typescript = '*' | ||
|
||
// Add eslint scripts | ||
packageJson.scripts.lint = 'eslint .' | ||
packageJson.scripts['lint:fix'] = 'eslint . --fix' | ||
|
||
// Save package.json and copy eslint configuration | ||
fs.copyFileSync(`${extrasRoot}/.eslintrc`, `${packageDir}/.eslintrc`) | ||
fs.writeFileSync(`${packageDir}/package.json`, JSON.stringify(packageJson, null, 2)) | ||
} | ||
|
||
export const installJSHint = (packageDir: string) => { | ||
// Parse package.json, add jshint dependencies and scripts | ||
const packageJson = JSON.parse(fs.readFileSync(`${packageDir}/package.json`, 'utf8')) | ||
|
||
packageJson.devDependencies.jshint = '*' | ||
packageJson.devDependencies['@antfu/jshint-config'] = '*' | ||
packageJson.devDependencies.typescript = '*' | ||
|
||
// Add jshint script | ||
packageJson.scripts.lint = 'jshint .' | ||
|
||
// Save package.json and copy jshint configuration | ||
fs.copyFileSync(`${extrasRoot}/.jshintrc`, `${packageDir}/.jshintrc`) | ||
fs.writeFileSync(`${packageDir}/package.json`, JSON.stringify(packageJson, null, 2)) | ||
} | ||
|
||
export const installTSLint = (packageDir: string) => { | ||
// Parse package.json, add tslint dependencies and scripts | ||
const packageJson = JSON.parse(fs.readFileSync(`${packageDir}/package.json`, 'utf8')) | ||
|
||
packageJson.devDependencies.tslint = '*' | ||
packageJson.devDependencies.typescript = '*' | ||
|
||
// Add tslint script | ||
packageJson.scripts.lint = 'tslint .' | ||
|
||
// Save package.json and copy tslint configuration | ||
fs.copyFileSync(`${extrasRoot}/tslint.json`, `${packageDir}/tslint.json`) | ||
fs.writeFileSync(`${packageDir}/package.json`, JSON.stringify(packageJson, null, 2)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"extends": "./.nuxt/tsconfig.json", | ||
} | ||
"extends": "./.nuxt/tsconfig.json" | ||
} |