eslint-config-yii
v1.2.3
Published
Personal eslint config. Supports typeScript, react, vue, next.js.
Downloads
7
Maintainers
Readme
eslint-config-yii
Personal eslint config. Supports typeScript, react, vue, next.js.
Usage
pnpm add -D eslint eslint-config-yii
Basic
module.exports = {
extends: ['yii'],
}
with typescript
module.exports = {
extends: ['yii/ts'],
}
React
module.exports = {
extends: ['yii/react'],
}
with typescript
module.exports = {
extends: ['yii/react-ts'],
}
with next.js
module.exports = {
extends: ['yii/react', 'yii/next'],
}
Vue
Default to vue3.
module.exports = {
extends: ['yii/vue'],
}
with typescript
module.exports = {
extends: ['yii/vue-ts'],
}
Tips
VSCode Settings
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"json",
"jsonc",
"json5",
"yml",
"yaml"
],
"[javascript][javascriptreact][typescript][typescriptreact]": {
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
"editor.formatOnType": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
}
Babel parser
Sometimes, you may need add babel as parser for new language features. See babel-eslint-parser for more information.
module.exports = {
parser: '@babel/eslint-parser',
}
Typescript path resolver
To enable typescript path resolvers in .js
files, you can add settings:
module.exports = {
settings: {
'import/resolver': {
typescript: {},
},
},
}
No need import React from 'react'
?
If you are using react 17, you don't need to import React for JSX. See https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#removing-unused-react-imports.
⚠ It is default after v4.