https://github.com/guoyunhe/lint-init-framework
Framework to make your own lint-init CLI tool
https://github.com/guoyunhe/lint-init-framework
Last synced: 3 months ago
JSON representation
Framework to make your own lint-init CLI tool
- Host: GitHub
- URL: https://github.com/guoyunhe/lint-init-framework
- Owner: guoyunhe
- License: mit
- Created: 2023-09-11T05:26:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-14T15:58:44.000Z (over 1 year ago)
- Last Synced: 2025-02-11T13:09:17.769Z (4 months ago)
- Language: TypeScript
- Size: 30.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# lint-init-framework
Framework to make your own lint-init CLI tool
## Install
```bash
npm install --save lint-init-framework
```## Usage
Create `lint-init.js` (or whatever you name it)
```js
#!/usr/bin/env nodeimport { makeCli } from 'lint-init-framework';
makeCli({
packageName: '@myorg/lint-init',
commandName: 'lint-init',
version: '1.2.0',
eslint: [{}],
stylelint: [],
markdownlint: {},
prettier: {},
editorconfig: '',
vscode: {},
});
```Modify your `package.json`:
```json
{
"bin": {
"lint-init": "./lint-init.js"
}
}
```## Options
### packageName
`name` field in `package.json`
### commandName
Name of the bin (see `bin` field in your `package.json`)
### version
`version` field in `package.json`
### eslint
Enalbe ESLint support
If you have multiple presets for different type of projects, pass an array of config with the following options:
#### eslint.deps
Entries of `devDependencies`.
```js
makeCli({
eslint: {
deps: {
'eslint-config-airbnb': '^8.0.0',
'eslint-plugin-import': '^11.0.0',
},
},
});
```#### eslint.config
Content of `.eslintrc.json` or `eslintConfig` field in `package.json`
#### eslint.configFile
File name of ESLint configuration
- `package.json` (`eslintConfig` field)
- `.eslintrc`
- `.eslintrc.json`
- `.eslintrc.yaml`
- `.eslintrc.js`#### eslint.ignore
Content of `.eslintignore`
```js
makeCli({
eslint: {
ignore: `node_modules/
build/
coverage/
dist/
`,
},
});
```### stylelint
Enalbe Stylelint support
If you have multiple presets for different type of projects, pass an array of config with the following options:
#### stylelint.deps
Entries of `devDependencies`.
```js
makeCli({
eslint: {
deps: {
'stylelint-config-standard': '^8.0.0',
'stylelint-scss': '^5.0.0',
},
},
});
```#### stylelint.config
Content of `.stylelintrc.json` or `stylelint` field in `package.json`
#### stylelint.configFile
File name of Stylelint configuration
- `package.json` (`stylelint` field)
- `.stylelintrc`
- `.stylelintrc.json`
- `.stylelintrc.yaml`
- `.stylelintrc.js`#### stylelint.ignore
Content of `.eslintignore`
```js
makeCli({
eslint: {
ignore: `node_modules/
build/
coverage/
dist/
`,
},
});
```### markdownlint
### prettier
Enable Prettier support
#### prettier.deps
Entries of `devDependencies`.
```js
makeCli({
eslint: {
deps: {
prettier: '^3.0.0',
'prettier-plugin-packagejson': '^2.0.0',
},
},
});
```#### prettier.config
Content of `.prettierrc.json` or `prettier` field in `package.json`
#### prettier.configFile
File name of Stylelint configuration
- `package.json` (`prettier` field)
- `.prettierrc`
- `.prettierrc.json`
- `.prettierrc.yaml`
- `.prettierrc.js`#### prettier.ignore
Content of `.prettierignore`
```js
makeCli({
eslint: {
ignore: `node_modules/
build/
coverage/
dist/
package-lock.json
pnpm-lock.yaml
yarn.lock
`,
},
});
```### editorconfig
Content of `.editorconfig`:
```js
makeCli({
editorconfig: `# Generated by lint-init
root = true[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single
`,
});
```### vscode
VS Code configuration
#### vscode.settings
Content of `.vscode/settings.json`:
```js
makeCli({
vscode: {
settings: {
'eslint.validate': ['javascript', 'typescript'],
'editor.codeActionsOnSave': {
'source.fixAll.eslint': true,
'source.organizeImports': true,
},
'editor.defaultFormatter': 'esbenp.prettier-vscode',
'editor.formatOnSave': true,
'editor.rulers': [100],
'[javascript]': {
'editor.defaultFormatter': 'esbenp.prettier-vscode',
},
'[typescript]': {
'editor.defaultFormatter': 'esbenp.prettier-vscode',
},
'[json]': {
'editor.defaultFormatter': 'esbenp.prettier-vscode',
},
'[jsonc]': {
'editor.defaultFormatter': 'esbenp.prettier-vscode',
},
},
},
});
```#### vscode.extensions
Content of `.vscode/extensions.json`:
```js
makeCli({
vscode: {
extensions: {
recommendations: [
'dbaeumer.vscode-eslint',
'editorconfig.editorconfig',
'esbenp.prettier-vscode',
],
},
},
});
```