Skip to content

Eslint rules for JavaScript projects. May be merged with other eslint-config settings.

License

Notifications You must be signed in to change notification settings

tobiaslabs/eslint-config-javascript

Repository files navigation

eslint-config-javascript

ESLint configurations for modern projects using JavaScript.

Look at the example config file for basic usage.

Note: uses ESLint 9 and modern JavaScript.

Using

Requires ESlint version 9 and above:

npm install --save-dev eslint@^9

Install the normal way:

npm install --save-dev eslint @tobiaslabs/eslint-config-javascript

Create an ESLint config file:

touch eslint.config.js

Overall Configuration

Import the default and use the config property as your overall configuration and style enforcement:

import javascript from '@tobiaslabs/eslint-config-javascript'
export default [
	...javascript.config,
]

Environment Globals

Specify globals for specific runtimes using the environment property and one of the following:

  • browser - Modern browser runtime.
  • mongosh - MongoDB shell runtime.
  • nodejs - Modern Node.js runtime.
  • serviceworker - Modern browser ServiceWorker runtime.

To use them, use the rest-spread inside an object, and specify the filepaths that execute in that environment.

For example, for JavaScript that is in a folder path src and executes in the browser:

import javascript from '@tobiaslabs/eslint-config-javascript'
export default [
	// ... other configurations, then ...
	{
		...javascript.environment.browser,
		files: [
			'src/**/*.js',
		],
	},
]

License

Published and released under the Very Open License.

About

Eslint rules for JavaScript projects. May be merged with other eslint-config settings.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published