Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
eslint, gulp 설정 및 관련 설정파일
module.exports = {
env: {
commonjs: true,
es6: true,
node: true,
},
extends: 'airbnb-base',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaVersion: 2018,
},
rules: {
"prefer-destructuring": ["error", {"object": false, "array": false }],
"max-len": ["error", { "code": 300 }],
"no-underscore-dangle": ["error", { "allowAfterThis": true, "allowAfterSuper": true }],
"camelcase": ["error", { "properties": "never" }],
"no-console": ["error", { allow: ["warn", "error", "log", "table"] }],
},
};
const { src, watch } = require('gulp');
const eslint = require('gulp-eslint');
const paths = [
'./*.js',
'bin/*',
'lib/**/*.js',
'routes/**/*.js',
'test/**/*.js',
'services/**/*.js',
];
function lintBase() {
return src(paths)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
function taskWatch() {
return watch(paths, lintBase);
}
exports.lint = lintBase;
exports.watch = taskWatch;
exports.default = taskWatch;
#################
# esLint 설정
#################
# eslint에서 로컬 설치를 권장
npm install --save-dev eslint
# 원하는 프로젝트 내에서 eslint 초기화 진행
npx eslint --init
# 이후 To check syntax, find problems, and enforce code style 를 선택해야
# 이름있는 코딩 스타일을 선택할 수 있음
#################
# gulp with esLint
#################
npm install -g gulp-cli
npm install --save-dev gulp
npm install --save-dev gulp-eslint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.