eslint-config-cobaltt7
v1.3.1
Published
My ESLint style guide
Downloads
1,225
Readme
eslint-config-cobaltt7
My ESLint style guide
Adding To A Project
Note that this style guide only works for TypeScript projects, so ensure you have TypeScript installed and configured prior to setting up ESLint.
Install the config by running:
npm install eslint-config-cobaltt7 eslint --save-dev --save-exactAdd the following to your
package.json:"scripts": { "lint": "eslint" }Create an
eslint.config.jsfile with the following content:import path from "node:path"; import { fileURLToPath } from "node:url"; import cobaltConfigs from "eslint-config-cobaltt7"; import { defineConfig } from "eslint/config"; export default defineConfig([ { files: ["./**/*.ts"] }, ...cobaltConfigs, { languageOptions: { parserOptions: { projectService: true, tsconfigRootDir: path.dirname(fileURLToPath(import.meta.url)), }, }, }, ]);Add
globalIgnoresglobs to omit certain files or folders from being linted, for example:@@ -1,10 +1,12 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; import cobaltConfigs, { declareConfig } from "eslint-config-cobaltt7"; -import { defineConfig } from "eslint/config"; +import { defineConfig, globalIgnores } from "eslint/configs"; export default defineConfig([ { files: ["./**/*.ts"] }, + globalIgnores(["dist"]), ...cobaltConfigs, { languageOptions: {Make sure to put
globalIgnoresin the position indicated.Edit project-specific configuration, i.e.
languageOptions,rules, and etcetera. Put all configuration in or after the last object containinglanguageOptions. Theglobalspackage is re-exported ineslint-config-cobaltt7, so it is unneccessary to reinstall it to modify global variables. Simply import it like so:import { globals } from "eslint-config-cobaltt7";To lint your code, simply run:
node --run lint
Congrats!
You've successfully integrated ESLint into your project with eslint-config-cobaltt7!
Importing specific configurations
The following configs are exported from this package independently:
import { configs } from "eslint-config-cobaltt7";
configs.global;
configs.configs;
configs.declarations;
configs.tests;Please note that, with the exeption of global, all of these configs include files overrides that may need to be overridden for the config to behave as expected.
