0.0.1 • Published 3 years ago
eslint-plugin-dev-helpers v0.0.1
ESLint 插件开发需要的公共函数包
当前仅提供了获取当前文件或文件名的方法
安装
npm install eslint-plugin-dev-helpers
# or
yarn add eslint-plugin-dev-helpers
# or
pnpm install eslint-plugin-dev-helpers
使用方法
const { getFilePath, getFilename, getBasename } = require('eslint-plugin-dev-helpers').filename
// 在 create() 函数中即可获取
create(context) {
// variables should be defined here
const filenameWithPath = getFilePath(context) // 文件路径
const filename = getFilename(filenameWithPath) // 文件名(带扩展名)
const basename = getBasename(filename) // 文件名(不带扩展名)
console.log("filename", basename)
}
0.0.1
3 years ago