diff --git a/crates/cli/src/reporter.rs b/crates/cli/src/reporter.rs index 549d27e4..a85fddf8 100644 --- a/crates/cli/src/reporter.rs +++ b/crates/cli/src/reporter.rs @@ -376,11 +376,9 @@ SELECT 1; assert_snapshot!(String::from_utf8_lossy(&buff), @r###" main.sql:1:29: warning: adding-required-field Adding a new column that is `NOT NULL` and has no default value to an existing table effectively makes it required. main.sql:1:29: warning: prefer-robust-stmts Missing `IF NOT EXISTS`, the migration can't be rerun if it fails part way through. - main.sql:1:46: warning: prefer-big-int Using 32-bit integer fields can result in hitting the max `int` limit. main.sql:1:46: warning: prefer-bigint-over-int Using 32-bit integer fields can result in hitting the max `int` limit. main.sql:2:23: warning: adding-required-field Adding a new column that is `NOT NULL` and has no default value to an existing table effectively makes it required. main.sql:2:23: warning: prefer-robust-stmts Missing `IF NOT EXISTS`, the migration can't be rerun if it fails part way through. - main.sql:2:40: warning: prefer-big-int Using 32-bit integer fields can result in hitting the max `int` limit. main.sql:2:40: warning: prefer-bigint-over-int Using 32-bit integer fields can result in hitting the max `int` limit. "###); } @@ -438,7 +436,7 @@ SELECT 1; ); assert!(res.is_ok()); - assert_snapshot!(String::from_utf8_lossy(&buff), @r###"[{"file":"main.sql","line":1,"column":29,"level":"Warning","message":"Adding a new column that is `NOT NULL` and has no default value to an existing table effectively makes it required.","help":"Make the field nullable or add a non-VOLATILE DEFAULT","rule_name":"adding-required-field"},{"file":"main.sql","line":1,"column":29,"level":"Warning","message":"Missing `IF NOT EXISTS`, the migration can't be rerun if it fails part way through.","help":null,"rule_name":"prefer-robust-stmts"},{"file":"main.sql","line":1,"column":46,"level":"Warning","message":"Using 32-bit integer fields can result in hitting the max `int` limit.","help":"Use 64-bit integer values instead to prevent hitting this limit.","rule_name":"prefer-big-int"},{"file":"main.sql","line":1,"column":46,"level":"Warning","message":"Using 32-bit integer fields can result in hitting the max `int` limit.","help":"Use 64-bit integer values instead to prevent hitting this limit.","rule_name":"prefer-bigint-over-int"},{"file":"main.sql","line":2,"column":23,"level":"Warning","message":"Adding a new column that is `NOT NULL` and has no default value to an existing table effectively makes it required.","help":"Make the field nullable or add a non-VOLATILE DEFAULT","rule_name":"adding-required-field"},{"file":"main.sql","line":2,"column":23,"level":"Warning","message":"Missing `IF NOT EXISTS`, the migration can't be rerun if it fails part way through.","help":null,"rule_name":"prefer-robust-stmts"},{"file":"main.sql","line":2,"column":40,"level":"Warning","message":"Using 32-bit integer fields can result in hitting the max `int` limit.","help":"Use 64-bit integer values instead to prevent hitting this limit.","rule_name":"prefer-big-int"},{"file":"main.sql","line":2,"column":40,"level":"Warning","message":"Using 32-bit integer fields can result in hitting the max `int` limit.","help":"Use 64-bit integer values instead to prevent hitting this limit.","rule_name":"prefer-bigint-over-int"}]"###); + assert_snapshot!(String::from_utf8_lossy(&buff), @r###"[{"file":"main.sql","line":1,"column":29,"level":"Warning","message":"Adding a new column that is `NOT NULL` and has no default value to an existing table effectively makes it required.","help":"Make the field nullable or add a non-VOLATILE DEFAULT","rule_name":"adding-required-field"},{"file":"main.sql","line":1,"column":29,"level":"Warning","message":"Missing `IF NOT EXISTS`, the migration can't be rerun if it fails part way through.","help":null,"rule_name":"prefer-robust-stmts"},{"file":"main.sql","line":1,"column":46,"level":"Warning","message":"Using 32-bit integer fields can result in hitting the max `int` limit.","help":"Use 64-bit integer values instead to prevent hitting this limit.","rule_name":"prefer-bigint-over-int"},{"file":"main.sql","line":2,"column":23,"level":"Warning","message":"Adding a new column that is `NOT NULL` and has no default value to an existing table effectively makes it required.","help":"Make the field nullable or add a non-VOLATILE DEFAULT","rule_name":"adding-required-field"},{"file":"main.sql","line":2,"column":23,"level":"Warning","message":"Missing `IF NOT EXISTS`, the migration can't be rerun if it fails part way through.","help":null,"rule_name":"prefer-robust-stmts"},{"file":"main.sql","line":2,"column":40,"level":"Warning","message":"Using 32-bit integer fields can result in hitting the max `int` limit.","help":"Use 64-bit integer values instead to prevent hitting this limit.","rule_name":"prefer-bigint-over-int"}]"###); } #[test] diff --git a/crates/cli/src/snapshots/squawk__reporter__test_reporter__display_violations_tty.snap b/crates/cli/src/snapshots/squawk__reporter__test_reporter__display_violations_tty.snap index 64615c17..5acb277d 100644 --- a/crates/cli/src/snapshots/squawk__reporter__test_reporter__display_violations_tty.snap +++ b/crates/cli/src/snapshots/squawk__reporter__test_reporter__display_violations_tty.snap @@ -15,13 +15,6 @@ warning[prefer-robust-stmts]: Missing `IF NOT EXISTS`, the migration can't be re 2 | ALTER TABLE "core_recipe" ADD COLUMN "foo" integer NOT NULL; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -warning[prefer-big-int]: Using 32-bit integer fields can result in hitting the max `int` limit. - --> main.sql:2:47 - | -2 | ALTER TABLE "core_recipe" ADD COLUMN "foo" integer NOT NULL; - | ^^^^^^^ - | - = help: Use 64-bit integer values instead to prevent hitting this limit. warning[prefer-bigint-over-int]: Using 32-bit integer fields can result in hitting the max `int` limit. --> main.sql:2:47 | @@ -42,13 +35,6 @@ warning[prefer-robust-stmts]: Missing `IF NOT EXISTS`, the migration can't be re 3 | ALTER TABLE "core_foo" ADD COLUMN "bar" integer NOT NULL; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -warning[prefer-big-int]: Using 32-bit integer fields can result in hitting the max `int` limit. - --> main.sql:3:41 - | -3 | ALTER TABLE "core_foo" ADD COLUMN "bar" integer NOT NULL; - | ^^^^^^^ - | - = help: Use 64-bit integer values instead to prevent hitting this limit. warning[prefer-bigint-over-int]: Using 32-bit integer fields can result in hitting the max `int` limit. --> main.sql:3:41 | @@ -58,4 +44,4 @@ warning[prefer-bigint-over-int]: Using 32-bit integer fields can result in hitti = help: Use 64-bit integer values instead to prevent hitting this limit. Find detailed examples and solutions for each rule at https://squawkhq.com/docs/rules -Found 8 issues in 1 file (checked 1 source file) +Found 6 issues in 1 file (checked 1 source file) diff --git a/crates/cli/src/snapshots/squawk__reporter__test_reporter__span_offsets.snap b/crates/cli/src/snapshots/squawk__reporter__test_reporter__span_offsets.snap index 037107f8..e206e57d 100644 --- a/crates/cli/src/snapshots/squawk__reporter__test_reporter__span_offsets.snap +++ b/crates/cli/src/snapshots/squawk__reporter__test_reporter__span_offsets.snap @@ -28,18 +28,6 @@ CheckReport { help: None, rule_name: "prefer-robust-stmts", }, - ReportViolation { - file: "main.sql", - line: 2, - column: 46, - range: 48..55, - level: Warning, - message: "Using 32-bit integer fields can result in hitting the max `int` limit.", - help: Some( - "Use 64-bit integer values instead to prevent hitting this limit.", - ), - rule_name: "prefer-big-int", - }, ReportViolation { file: "main.sql", line: 2, @@ -74,18 +62,6 @@ CheckReport { help: None, rule_name: "prefer-robust-stmts", }, - ReportViolation { - file: "main.sql", - line: 3, - column: 40, - range: 106..113, - level: Warning, - message: "Using 32-bit integer fields can result in hitting the max `int` limit.", - help: Some( - "Use 64-bit integer values instead to prevent hitting this limit.", - ), - rule_name: "prefer-big-int", - }, ReportViolation { file: "main.sql", line: 3, diff --git a/crates/squawk_linter/src/lib.rs b/crates/squawk_linter/src/lib.rs index 7be9e356..6fd3e28c 100644 --- a/crates/squawk_linter/src/lib.rs +++ b/crates/squawk_linter/src/lib.rs @@ -17,6 +17,7 @@ pub use version::Version; mod ignore; mod ignore_index; mod version; +mod visitors; mod rules; mod text; @@ -36,7 +37,6 @@ use rules::ban_drop_table; use rules::changing_column_type; use rules::constraint_missing_not_valid; use rules::disallow_unique_constraint; -use rules::prefer_big_int; use rules::prefer_bigint_over_int; use rules::prefer_bigint_over_smallint; use rules::prefer_identity; @@ -75,8 +75,6 @@ pub enum Rule { DisallowedUniqueConstraint, #[serde(rename = "ban-drop-database")] BanDropDatabase, - #[serde(rename = "prefer-big-int")] - PreferBigInt, #[serde(rename = "prefer-bigint-over-int")] PreferBigintOverInt, #[serde(rename = "prefer-bigint-over-smallint")] @@ -129,7 +127,6 @@ impl TryFrom<&str> for Rule { "renaming-table" => Ok(Rule::RenamingTable), "disallowed-unique-constraint" => Ok(Rule::DisallowedUniqueConstraint), "ban-drop-database" => Ok(Rule::BanDropDatabase), - "prefer-big-int" => Ok(Rule::PreferBigInt), "prefer-bigint-over-int" => Ok(Rule::PreferBigintOverInt), "prefer-bigint-over-smallint" => Ok(Rule::PreferBigintOverSmallint), "prefer-identity" => Ok(Rule::PreferIdentity), @@ -186,7 +183,6 @@ impl fmt::Display for Rule { Rule::RenamingTable => "renaming-table", Rule::DisallowedUniqueConstraint => "disallowed-unique-constraint", Rule::BanDropDatabase => "ban-drop-database", - Rule::PreferBigInt => "prefer-big-int", Rule::PreferBigintOverInt => "prefer-bigint-over-int", Rule::PreferBigintOverSmallint => "prefer-bigint-over-smallint", Rule::PreferIdentity => "prefer-identity", @@ -308,9 +304,6 @@ impl Linter { if self.rules.contains(&Rule::DisallowedUniqueConstraint) { disallow_unique_constraint(self, &file); } - if self.rules.contains(&Rule::PreferBigInt) { - prefer_big_int(self, &file); - } if self.rules.contains(&Rule::PreferBigintOverInt) { prefer_bigint_over_int(self, &file); } diff --git a/crates/squawk_linter/src/rules/ban_char_field.rs b/crates/squawk_linter/src/rules/ban_char_field.rs index 49e40da1..78a047d8 100644 --- a/crates/squawk_linter/src/rules/ban_char_field.rs +++ b/crates/squawk_linter/src/rules/ban_char_field.rs @@ -3,7 +3,7 @@ use squawk_syntax::{ Parse, SourceFile, TokenText, }; -use crate::prefer_big_int::check_not_allowed_types; +use crate::visitors::check_not_allowed_types; use crate::{Linter, Rule, Violation}; fn is_char_type(x: TokenText<'_>) -> bool { diff --git a/crates/squawk_linter/src/rules/mod.rs b/crates/squawk_linter/src/rules/mod.rs index f8f69e3f..7b909d85 100644 --- a/crates/squawk_linter/src/rules/mod.rs +++ b/crates/squawk_linter/src/rules/mod.rs @@ -14,7 +14,6 @@ pub(crate) mod ban_drop_table; pub(crate) mod changing_column_type; pub(crate) mod constraint_missing_not_valid; pub(crate) mod disallow_unique_constraint; -pub(crate) mod prefer_big_int; pub(crate) mod prefer_bigint_over_int; pub(crate) mod prefer_bigint_over_smallint; pub(crate) mod prefer_identity; @@ -43,7 +42,6 @@ pub(crate) use ban_drop_table::ban_drop_table; pub(crate) use changing_column_type::changing_column_type; pub(crate) use constraint_missing_not_valid::constraint_missing_not_valid; pub(crate) use disallow_unique_constraint::disallow_unique_constraint; -pub(crate) use prefer_big_int::prefer_big_int; pub(crate) use prefer_bigint_over_int::prefer_bigint_over_int; pub(crate) use prefer_bigint_over_smallint::prefer_bigint_over_smallint; pub(crate) use prefer_identity::prefer_identity; diff --git a/crates/squawk_linter/src/rules/prefer_big_int.rs b/crates/squawk_linter/src/rules/prefer_big_int.rs deleted file mode 100644 index 711d7849..00000000 --- a/crates/squawk_linter/src/rules/prefer_big_int.rs +++ /dev/null @@ -1,231 +0,0 @@ -use std::collections::HashSet; - -use squawk_syntax::{ - ast::{self, AstNode, HasModuleItem}, - Parse, SourceFile, -}; - -use crate::{text::trim_quotes, Linter, Rule, Violation}; -use lazy_static::lazy_static; - -lazy_static! { - static ref SMALL_INT_TYPES: HashSet<&'static str> = HashSet::from([ - "smallint", - "integer", - "int2", - "int4", - "serial", - "serial2", - "serial4", - "smallserial", - ]); -} - -pub(crate) fn is_not_valid_int_type(ty: &ast::Type, invalid_type_names: &HashSet<&str>) -> bool { - match ty { - ast::Type::ArrayType(array_type) => { - if let Some(ty) = array_type.ty() { - is_not_valid_int_type(&ty, invalid_type_names) - } else { - false - } - } - ast::Type::PercentType(_) => false, - ast::Type::PathType(path_type) => { - let Some(ty_name) = path_type - .path() - .and_then(|x| x.segment()) - .and_then(|x| x.name_ref()) - .map(|x| x.text().to_string()) - else { - return false; - }; - let name = trim_quotes(ty_name.as_str()); - invalid_type_names.contains(name) - } - ast::Type::CharType(_) => false, - ast::Type::BitType(_) => false, - ast::Type::DoubleType(_) => false, - ast::Type::TimeType(_) => false, - ast::Type::IntervalType(_) => false, - } -} - -pub(crate) fn check_not_allowed_types( - ctx: &mut Linter, - file: &ast::SourceFile, - check_ty: impl Fn(&mut Linter, Option), -) { - for item in file.items() { - match item { - ast::Item::CreateTable(create_table) => { - if let Some(table_args) = create_table.table_args() { - for arg in table_args.args() { - if let ast::TableArg::Column(column) = arg { - check_ty(ctx, column.ty()); - } - } - } - } - ast::Item::AlterTable(alter_table) => { - for action in alter_table.actions() { - match action { - ast::AlterTableAction::AddColumn(add_column) => { - check_ty(ctx, add_column.ty()); - } - ast::AlterTableAction::AlterColumn(alter_column) => { - if let Some(ast::AlterColumnOption::SetType(set_type)) = - alter_column.option() - { - check_ty(ctx, set_type.ty()); - } - } - _ => (), - } - } - } - _ => (), - } - } -} - -fn check_ty_for_big_int(ctx: &mut Linter, ty: Option) { - if let Some(ty) = ty { - if is_not_valid_int_type(&ty, &SMALL_INT_TYPES) { - ctx.report(Violation::new( - Rule::PreferBigInt, - "Using 32-bit integer fields can result in hitting the max `int` limit.".into(), - ty.syntax().text_range(), - "Use 64-bit integer values instead to prevent hitting this limit.".to_string(), - )); - }; - } -} - -pub(crate) fn prefer_big_int(ctx: &mut Linter, parse: &Parse) { - let file = parse.tree(); - check_not_allowed_types(ctx, &file, check_ty_for_big_int); -} - -#[cfg(test)] -mod test { - use insta::assert_debug_snapshot; - - use crate::{Linter, Rule}; - - #[test] - fn err() { - let sql = r#" -create table users ( - id smallint -); -create table users ( - id int2 -); -create table users ( - id integer -); -create table users ( - id int4 -); -create table users ( - id serial -); -create table users ( - id serial2 -); -create table users ( - id serial4 -); -create table users ( - id smallserial -); - "#; - let file = squawk_syntax::SourceFile::parse(sql); - let mut linter = Linter::from([Rule::PreferBigInt]); - let errors = linter.lint(file, sql); - assert_ne!(errors.len(), 0); - assert_eq!(errors.len(), 8); - assert_eq!( - errors - .iter() - .filter(|x| x.code == Rule::PreferBigInt) - .count(), - 8 - ); - assert_debug_snapshot!(errors); - } - - #[test] - fn ok() { - let sql = r#" -create table users ( - id bigint -); -create table users ( - id int8 -); -create table users ( - id bigserial -); -create table users ( - id serial8 -); - "#; - let file = squawk_syntax::SourceFile::parse(sql); - let mut linter = Linter::from([Rule::PreferBigInt]); - let errors = linter.lint(file, sql); - assert_eq!(errors.len(), 0); - } - - #[test] - fn create_table_many_err() { - let sql = r#" -create table users ( - foo integer, - bar serial -); - "#; - let file = squawk_syntax::SourceFile::parse(sql); - let mut linter = Linter::from([Rule::PreferBigInt]); - let errors = linter.lint(file, sql); - assert_ne!(errors.len(), 0); - assert_debug_snapshot!(errors); - } - - #[test] - fn alter_table_add_column_err() { - let sql = r#" -alter table t add column c integer; - "#; - let file = squawk_syntax::SourceFile::parse(sql); - let mut linter = Linter::from([Rule::PreferBigInt]); - let errors = linter.lint(file, sql); - assert_ne!(errors.len(), 0); - assert_debug_snapshot!(errors); - } - - #[test] - fn alter_table_alter_column_type_err() { - let sql = r#" -alter table t alter column c type integer; - "#; - let file = squawk_syntax::SourceFile::parse(sql); - let mut linter = Linter::from([Rule::PreferBigInt]); - let errors = linter.lint(file, sql); - assert_ne!(errors.len(), 0); - assert_debug_snapshot!(errors); - } - - #[test] - fn alter_table_alter_column_type_with_quotes_err() { - let sql = r#" -alter table t alter column c type "integer"; - "#; - let file = squawk_syntax::SourceFile::parse(sql); - let mut linter = Linter::from([Rule::PreferBigInt]); - let errors = linter.lint(file, sql); - assert_ne!(errors.len(), 0); - assert_debug_snapshot!(errors); - } -} diff --git a/crates/squawk_linter/src/rules/prefer_bigint_over_int.rs b/crates/squawk_linter/src/rules/prefer_bigint_over_int.rs index 75222435..e0af8eee 100644 --- a/crates/squawk_linter/src/rules/prefer_bigint_over_int.rs +++ b/crates/squawk_linter/src/rules/prefer_bigint_over_int.rs @@ -5,8 +5,8 @@ use squawk_syntax::{ast, Parse, SourceFile}; use crate::{Linter, Rule, Violation}; -use crate::prefer_big_int::check_not_allowed_types; -use crate::prefer_big_int::is_not_valid_int_type; +use crate::visitors::check_not_allowed_types; +use crate::visitors::is_not_valid_int_type; use lazy_static::lazy_static; diff --git a/crates/squawk_linter/src/rules/prefer_bigint_over_smallint.rs b/crates/squawk_linter/src/rules/prefer_bigint_over_smallint.rs index 7fe28b0c..f600698d 100644 --- a/crates/squawk_linter/src/rules/prefer_bigint_over_smallint.rs +++ b/crates/squawk_linter/src/rules/prefer_bigint_over_smallint.rs @@ -5,8 +5,8 @@ use squawk_syntax::{ast, Parse, SourceFile}; use crate::{Linter, Rule, Violation}; -use crate::prefer_big_int::check_not_allowed_types; -use crate::prefer_big_int::is_not_valid_int_type; +use crate::visitors::check_not_allowed_types; +use crate::visitors::is_not_valid_int_type; use lazy_static::lazy_static; diff --git a/crates/squawk_linter/src/rules/prefer_identity.rs b/crates/squawk_linter/src/rules/prefer_identity.rs index 51cf42f8..823aaac7 100644 --- a/crates/squawk_linter/src/rules/prefer_identity.rs +++ b/crates/squawk_linter/src/rules/prefer_identity.rs @@ -9,7 +9,7 @@ use crate::{Linter, Rule, Violation}; use lazy_static::lazy_static; -use crate::prefer_big_int::{check_not_allowed_types, is_not_valid_int_type}; +use crate::visitors::{check_not_allowed_types, is_not_valid_int_type}; lazy_static! { static ref SERIAL_TYPES: HashSet<&'static str> = HashSet::from([ diff --git a/crates/squawk_linter/src/rules/prefer_text_field.rs b/crates/squawk_linter/src/rules/prefer_text_field.rs index 97637312..dc7e5ba5 100644 --- a/crates/squawk_linter/src/rules/prefer_text_field.rs +++ b/crates/squawk_linter/src/rules/prefer_text_field.rs @@ -7,7 +7,7 @@ use squawk_syntax::{ use crate::{text::trim_quotes, Linter, Rule, Violation}; -use crate::prefer_big_int::check_not_allowed_types; +use crate::visitors::check_not_allowed_types; use lazy_static::lazy_static; diff --git a/crates/squawk_linter/src/rules/prefer_timestamptz.rs b/crates/squawk_linter/src/rules/prefer_timestamptz.rs index a2a1b45a..f88297f0 100644 --- a/crates/squawk_linter/src/rules/prefer_timestamptz.rs +++ b/crates/squawk_linter/src/rules/prefer_timestamptz.rs @@ -3,7 +3,7 @@ use squawk_syntax::{ Parse, SourceFile, }; -use crate::{prefer_big_int::check_not_allowed_types, text::trim_quotes}; +use crate::{text::trim_quotes, visitors::check_not_allowed_types}; use crate::{Linter, Rule, Violation}; pub fn is_not_allowed_timestamp(ty: &ast::Type) -> bool { diff --git a/crates/squawk_linter/src/visitors.rs b/crates/squawk_linter/src/visitors.rs new file mode 100644 index 00000000..39f97124 --- /dev/null +++ b/crates/squawk_linter/src/visitors.rs @@ -0,0 +1,73 @@ +use std::collections::HashSet; + +use squawk_syntax::ast::{self, HasModuleItem}; + +use crate::{text::trim_quotes, Linter}; + +pub(crate) fn is_not_valid_int_type(ty: &ast::Type, invalid_type_names: &HashSet<&str>) -> bool { + match ty { + ast::Type::ArrayType(array_type) => { + if let Some(ty) = array_type.ty() { + is_not_valid_int_type(&ty, invalid_type_names) + } else { + false + } + } + ast::Type::PercentType(_) => false, + ast::Type::PathType(path_type) => { + let Some(ty_name) = path_type + .path() + .and_then(|x| x.segment()) + .and_then(|x| x.name_ref()) + .map(|x| x.text().to_string()) + else { + return false; + }; + let name = trim_quotes(ty_name.as_str()); + invalid_type_names.contains(name) + } + ast::Type::CharType(_) => false, + ast::Type::BitType(_) => false, + ast::Type::DoubleType(_) => false, + ast::Type::TimeType(_) => false, + ast::Type::IntervalType(_) => false, + } +} + +pub(crate) fn check_not_allowed_types( + ctx: &mut Linter, + file: &ast::SourceFile, + check_ty: impl Fn(&mut Linter, Option), +) { + for item in file.items() { + match item { + ast::Item::CreateTable(create_table) => { + if let Some(table_args) = create_table.table_args() { + for arg in table_args.args() { + if let ast::TableArg::Column(column) = arg { + check_ty(ctx, column.ty()); + } + } + } + } + ast::Item::AlterTable(alter_table) => { + for action in alter_table.actions() { + match action { + ast::AlterTableAction::AddColumn(add_column) => { + check_ty(ctx, add_column.ty()); + } + ast::AlterTableAction::AlterColumn(alter_column) => { + if let Some(ast::AlterColumnOption::SetType(set_type)) = + alter_column.option() + { + check_ty(ctx, set_type.ty()); + } + } + _ => (), + } + } + } + _ => (), + } + } +} diff --git a/docs/docs/prefer-big-int.md b/docs/docs/prefer-big-int.md deleted file mode 100644 index 73069224..00000000 --- a/docs/docs/prefer-big-int.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: prefer-big-int -title: prefer-big-int ---- - -## deprecated - -:::caution Deprecated -This rule has been deprecated in favor of ["prefer-bigint-over-int"](./prefer-bigint-over-int.md) and ["prefer-bigint-over-smallint"](./prefer-bigint-over-smallint.md). -::: - -This rule has been split into ["prefer-bigint-over-int"](./prefer-bigint-over-int.md) and ["prefer-bigint-over-smallint"](./prefer-bigint-over-smallint.md) to allow more granular linting against integer fields. Please use this new rules as this rule will be removed in a future release. diff --git a/docs/sidebars.js b/docs/sidebars.js index 83612aa1..4da4e126 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -17,7 +17,6 @@ module.exports = { "changing-column-type", "constraint-missing-not-valid", "disallowed-unique-constraint", - "prefer-big-int", "prefer-bigint-over-int", "prefer-bigint-over-smallint", "prefer-identity", diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index 04eee503..ef128e92 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -115,11 +115,6 @@ const rules = [ tags: ["locking"], description: "Prevent blocking reads/writes to table while index is built.", }, - { - name: "prefer-big-int", - tags: ["schema"], - description: "Deprecated. See prefer-bigint-over-int and prefer-bigint-over-smallint instead.", - }, { name: "prefer-bigint-over-int", tags: ["schema"], diff --git a/playground/src/App.tsx b/playground/src/App.tsx index 81aa24d8..3bbaef56 100644 --- a/playground/src/App.tsx +++ b/playground/src/App.tsx @@ -15,7 +15,7 @@ type Mode = (typeof modes)[number] const DEFAULT_CONTENT = `\ create table users ( - -- squawk-ignore prefer-big-int,prefer-bigint-over-int + -- squawk-ignore prefer-bigint-over-int id serial ); diff --git a/playground/src/squawk.tsx b/playground/src/squawk.tsx index b3e89437..8ae6fe8f 100644 --- a/playground/src/squawk.tsx +++ b/playground/src/squawk.tsx @@ -1,5 +1,9 @@ import { useEffect, useState } from "react" -import initWasm, { dump_cst, dump_tokens, lint as lint_ } from "./pkg/wasm" +import initWasm, { + dump_cst, + dump_tokens, + lint as lint_, +} from "./pkg/squawk_wasm" export type LintError = { code: string