0.1.10 • Published 2 years ago
vite-plugin-naming v0.1.10
Enforce a case style for file and folder names
Enforces all linted files and folders to have their names in a certain case style and lowercase file extension. The default is kebab.
Cases
kebab
foo-bar.jsfoo-bar.test.jsfoo-bar.test-utils.js
camel
fooBar.jsfooBar.test.jsfooBar.testUtils.js
pascal
FooBar.jsFooBar.Test.jsFooBar.TestUtils.js
snake
foo_bar.jsfoo_bar.test.jsfoo_bar.test_utils.js
flat
foobar.jsfoobar.test.jsfoobar.testutils.js
Install
$ yarn add --dev vite-plugin-namingUsage
import { defineConfig } from 'vite';
import NamingPlugin from 'vite-plugin-naming';
export default defineConfig({
plugins: [
NamingPlugin({
/* options */
}),
],
});Options
match
Type: {string[]}
You can set the match option to allow multiple cases.
export default defineConfig({
plugins: [
NamingPlugin({
match: ['kebab', 'camel'],
}),
],
});ignore
Type: {regexp[]}
You can set the ignore option to ignore specific files and directories.
export default defineConfig({
plugins: [
NamingPlugin({
match: ['kebab', 'camel'],
ignore: [/node_modules/],
}),
],
});Don't forget that you must escape special characters that you don't want to be interpreted as part of the regex, for example, if you have [ in the actual filename. For example, to match [id].js, use /^\[id]\.js$/ or '^\\[id]\\.js$'.